Don't import tasks in iptables reload and use listen

This syntax doesn't work in Ansible 2.8.0.  Futher, we can use
"listen" to collapse the notify to a single item (at the
expense of duplicating the when clause in the handlers).

Change-Id: I05e2d32f4e1e692ac528a7254c6e3be2858ebacf
This commit is contained in:
James E. Blair 2018-12-03 08:59:30 -08:00
parent 330ffb394b
commit 3706754b6b
4 changed files with 15 additions and 15 deletions

View File

@ -1,11 +1,20 @@
- name: Reload iptables Debian
import_tasks: tasks/reload-debian.yaml
- name: Reload iptables (Debian)
command: '{{ reload_command }}'
when:
- not ansible_facts.is_chroot
- ansible_facts.os_family == 'Debian'
listen: "Reload iptables"
- name: Reload iptables RedHat
import_tasks: tasks/reload-redhat.yaml
- name: Reload iptables (RedHat)
command: 'systemctl reload iptables'
when:
- not ansible_facts.is_chroot
- ansible_facts.os_family == 'RedHat'
listen: "Reload iptables"
- name: Reload ip6tables (Red Hat)
command: 'systemctl reload ip6tables'
when:
- not ansible_facts.is_chroot
- ansible_facts.os_family == 'RedHat'
listen: "Reload iptables"

View File

@ -25,8 +25,7 @@
mode: 0640
setype: '{{ setype | default(omit) }}'
notify:
- Reload iptables Debian
- Reload iptables RedHat
- Reload iptables
- name: Install IPv6 rules files
template:
@ -37,8 +36,7 @@
mode: 0640
setype: '{{ setype | default(omit) }}'
notify:
- Reload iptables Debian
- Reload iptables RedHat
- Reload iptables
- name: Include OS specific tasks
include_tasks: "{{ item }}"

View File

@ -1,2 +0,0 @@
- name: Reload iptables (Debian)
command: '{{ reload_command }}'

View File

@ -1,5 +0,0 @@
- name: Reload iptables (Red Hat)
command: 'systemctl reload iptables'
- name: Reload ip6tables (Red Hat)
command: 'systemctl reload ip6tables'