diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..989ce5c --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1 @@ +firewall_enabled: true \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index 536903d..d34868f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,8 +1,8 @@ - include: centos.yml - when: ansible_distribution == 'CentOS' + when: firewall_enabled|bool and ansible_distribution == 'CentOS' - include: debian.yml - when: ansible_distribution == 'Debian' + when: firewall_enabled|bool and ansible_distribution == 'Debian' - name: "Ensure the iptables.d directory exists" file: > @@ -11,6 +11,7 @@ mode=0700 owner=root group=root + when: firewall_enabled|bool tags: - firewall @@ -22,6 +23,7 @@ backup=no owner=root group=root + when: firewall_enabled|bool register: firewall_rule tags: - firewall @@ -30,6 +32,6 @@ - name: "Reload the firewall" firewall: > state=reloaded - when: firewall_rule|changed + when: firewall_enabled|bool and firewall_rule|changed tags: - firewall