summaryrefslogtreecommitdiff
path: root/roles/configure_iptables
diff options
context:
space:
mode:
authorNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-25 14:33:23 +0100
committerNiklas Yann Wettengel <niyawe@niyawe.de>2017-03-25 14:33:23 +0100
commitcb3abd557431cc04aef5de1b302bcde25cd81c81 (patch)
tree4fd7058270e4e9d87ccf9778b85e573faccb2cbd /roles/configure_iptables
parent62a74b1ed442dc8c8a1224aa8edceeb3ed9c1b84 (diff)
added reload and restart handlers
Diffstat (limited to 'roles/configure_iptables')
-rw-r--r--roles/configure_iptables/handlers/main.yml10
-rw-r--r--roles/configure_iptables/tasks/main.yml10
2 files changed, 14 insertions, 6 deletions
diff --git a/roles/configure_iptables/handlers/main.yml b/roles/configure_iptables/handlers/main.yml
new file mode 100644
index 0000000..63f34e9
--- /dev/null
+++ b/roles/configure_iptables/handlers/main.yml
@@ -0,0 +1,10 @@
+---
+- name: reload iptables
+ systemd:
+ name: iptables.service
+ state: reloaded
+
+- name: reload ip6tables
+ systemd:
+ name: ip6tables.service
+ state: reloaded
diff --git a/roles/configure_iptables/tasks/main.yml b/roles/configure_iptables/tasks/main.yml
index 34f6c27..e0e6625 100644
--- a/roles/configure_iptables/tasks/main.yml
+++ b/roles/configure_iptables/tasks/main.yml
@@ -3,24 +3,22 @@
copy:
src: iptables.rules
dest: /etc/iptables/iptables.rules
- register: iptables_rules
+ notify: reload iptables
- name: start and enable iptables service
- when: iptables_rules.changed
systemd:
name: iptables.service
enabled: yes
- state: reloaded
+ state: started
- name: copy ip6tables.rules
copy:
src: ip6tables.rules
dest: /etc/iptables/ip6tables.rules
- register: ip6tables_rules
+ notify: reload ip6tables
- name: start and enable ip6tables service
- when: ip6tables_rules.changed
systemd:
name: ip6tables.service
enabled: yes
- state: reloaded
+ state: started