aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roles/firewall/tasks/main.yml
blob: 909eaa4e14ee749d1ec0ce812d7fe400e9035027 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
- name: Install iptables-persistent
  become: true
  ansible.builtin.apt:
    name: iptables-persistent
    state: present
    install_recommends: false

- name: Configure rule files
  become: true
  ansible.builtin.template:
    src: '{{ item.src }}'
    dest: '{{ item.dest }}'
    owner: root
    group: root
    mode: '640'
    validate: '/usr/sbin/{{ item.tool }}-restore --test %s'
  notify: firewall_reboot
  loop:
    - {src: rules.v4.j2, dest: /etc/iptables/rules.v4, tool: iptables}
    - {src: rules.v6.j2, dest: /etc/iptables/rules.v6, tool: ip6tables}

- name: Reboot if necessary
  ansible.builtin.meta: flush_handlers