|
@@ -5,6 +5,9 @@
|
5
|
5
|
- name: Install ufw
|
6
|
6
|
apt: pkg=ufw state=present
|
7
|
7
|
|
|
8
|
+- name: Deny everything and enable UFW
|
|
9
|
+ ufw: state=enabled policy=deny
|
|
10
|
+
|
8
|
11
|
- name: Set firewall rule for DNS
|
9
|
12
|
ufw: rule=allow port=domain
|
10
|
13
|
|
|
@@ -18,11 +21,6 @@
|
18
|
21
|
- http
|
19
|
22
|
- https
|
20
|
23
|
|
21
|
|
-- name: Check status of ufw
|
22
|
|
- command: ufw status
|
23
|
|
- register: ufw_status
|
24
|
|
- changed_when: False # never report as "changed"
|
25
|
|
-
|
26
|
24
|
- name: Check config of ufw
|
27
|
25
|
command: cat /etc/ufw/ufw.conf
|
28
|
26
|
register: ufw_config
|
|
@@ -31,7 +29,3 @@
|
31
|
29
|
- name: Disable logging (workaround for known bug in Debian 7)
|
32
|
30
|
ufw: logging=off
|
33
|
31
|
when: "ansible_lsb['codename'] == 'wheezy' and 'LOGLEVEL=off' not in ufw_config.stdout"
|
34
|
|
-
|
35
|
|
-- name: Enable ufw
|
36
|
|
- ufw: state=enabled
|
37
|
|
- when: "ufw_status.stdout.startswith('Status: inactive') or 'ENABLED=yes' not in ufw_config.stdout"
|