Skip to content

Commit

Permalink
Merge pull request #4 from christopherobin/feature/enable
Browse files Browse the repository at this point in the history
Add a flag to disable firewall
  • Loading branch information
MiLk committed Dec 24, 2015
2 parents e7b40ca + d573c42 commit bf152af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
firewall_enabled: true
8 changes: 5 additions & 3 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -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: >
Expand All @@ -11,6 +11,7 @@
mode=0700
owner=root
group=root
when: firewall_enabled|bool
tags:
- firewall

Expand All @@ -22,6 +23,7 @@
backup=no
owner=root
group=root
when: firewall_enabled|bool
register: firewall_rule
tags:
- firewall
Expand All @@ -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

0 comments on commit bf152af

Please sign in to comment.