2018-12-29 14:50:04 +01:00
|
|
|
---
|
|
|
|
# Make sure ufw is installed
|
|
|
|
- name: Install EPEL repository (RHEL only)
|
2019-04-05 19:06:22 +02:00
|
|
|
include_role:
|
|
|
|
name: setup_epel
|
2018-12-29 14:50:04 +01:00
|
|
|
when: ansible_distribution == 'RedHat'
|
|
|
|
- name: Install iptables (SuSE only)
|
|
|
|
package:
|
|
|
|
name: iptables
|
2019-12-02 08:01:44 +01:00
|
|
|
become: yes
|
2018-12-29 14:50:04 +01:00
|
|
|
when: ansible_os_family == 'Suse'
|
|
|
|
- name: Install ufw
|
2019-12-02 08:01:44 +01:00
|
|
|
become: yes
|
2018-12-29 14:50:04 +01:00
|
|
|
package:
|
|
|
|
name: ufw
|
2019-01-08 14:00:20 +01:00
|
|
|
|
2018-12-29 14:50:04 +01:00
|
|
|
# Run the tests
|
|
|
|
- block:
|
|
|
|
- include_tasks: run-test.yml
|
|
|
|
with_fileglob:
|
|
|
|
- "tests/*.yml"
|
2019-12-02 08:01:44 +01:00
|
|
|
become: yes
|
2019-01-08 14:00:20 +01:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
always:
|
2019-01-09 20:59:23 +01:00
|
|
|
- pause:
|
|
|
|
# ufw creates backups of the rule files with a timestamp; if reset is called
|
|
|
|
# twice in a row fast enough (so that both timestamps are taken in the same second),
|
|
|
|
# the second call will notice that the backup files are already there and fail.
|
|
|
|
# Waiting one second fixes this problem.
|
|
|
|
seconds: 1
|
2019-01-08 14:00:20 +01:00
|
|
|
- name: Reset ufw to factory defaults and disable
|
|
|
|
ufw:
|
|
|
|
state: reset
|