zuul-jobs/roles/persistent-firewall/tasks/main.yaml
David Moreau-Simard 0bb84bc58e
Persist iptables rules
We configured iptables rules but did not persist them.
This meant that rules would be flushed when restarting iptables or
the instance.

Change-Id: I9d90f55323a33d6a0f0dda1f7ab25d10984fa6cb
2017-10-31 17:39:32 -04:00

23 lines
592 B
YAML

- name: List current ipv4 rules
become: yes
command: iptables-save
changed_when: false
failed_when: false
register: iptables_rules
- name: List current ipv6 rules
become: yes
command: ip6tables-save
changed_when: false
failed_when: false
register: ip6tables_rules
- name: Configure persistent iptables rules
include: "{{ item }}"
static: no
with_first_found:
- "persist/{{ ansible_distribution }}_{{ ansible_distribution_release }}.yaml"
- "persist/{{ ansible_distribution }}.yaml"
- "persist/{{ ansible_os_family }}.yaml"
- "persist/default.yaml"