2017-05-18 00:54:43 +02:00
|
|
|
---
|
2018-07-06 23:18:11 +02:00
|
|
|
- name: Setup iptables
|
|
|
|
block:
|
2019-01-12 14:29:51 +01:00
|
|
|
- name: Set custom iptables rules
|
|
|
|
iptables_raw:
|
|
|
|
name: 'iptables_custom_rules_{{ item.name }}'
|
|
|
|
rules: '{{ item.rules }}'
|
|
|
|
state: '{{ item.state }}'
|
2019-09-18 11:36:34 +02:00
|
|
|
weight: '{{ item.weight | default(omit) }}'
|
|
|
|
table: '{{ item.table | default(omit) }}'
|
2019-10-28 20:30:54 +01:00
|
|
|
loop: '{{ iptables_custom_rules + iptables_custom_rules_extra }}'
|
2019-01-12 14:29:51 +01:00
|
|
|
loop_control:
|
2019-01-12 14:47:03 +01:00
|
|
|
label: "{{ item.name }}"
|
2017-05-18 00:54:43 +02:00
|
|
|
|
2019-10-28 20:38:54 +01:00
|
|
|
- name: Set applications iptables rules
|
|
|
|
iptables_raw:
|
|
|
|
name: '{{ item.name }}'
|
|
|
|
rules: '{{ item.rules }}'
|
|
|
|
state: '{{ item.state }}'
|
|
|
|
weight: '{{ item.weight | default(omit) }}'
|
|
|
|
table: '{{ item.table | default(omit) }}'
|
|
|
|
loop: '{{ iptables_app_rules + iptables_app_rules_extra }}'
|
|
|
|
loop_control:
|
|
|
|
label: "{{ item.name }}"
|
|
|
|
|
2019-01-12 14:29:51 +01:00
|
|
|
- name: Set default iptables head rules
|
|
|
|
iptables_raw:
|
|
|
|
name: iptables_default_head
|
|
|
|
weight: 10
|
|
|
|
keep_unmanaged: '{{ iptables_keep_unmanaged }}'
|
|
|
|
state: present
|
|
|
|
rules: '{{ iptables_default_head }}'
|
2017-07-13 21:27:26 +02:00
|
|
|
|
2019-01-12 14:29:51 +01:00
|
|
|
- name: Set default iptables tail rules
|
|
|
|
iptables_raw:
|
|
|
|
name: iptables_default_tail
|
|
|
|
weight: 99
|
|
|
|
keep_unmanaged: '{{ iptables_keep_unmanaged }}'
|
2019-01-12 14:47:03 +01:00
|
|
|
state: '{{ (not iptables_default_tail) | ternary("absent", "present") }}'
|
2019-01-12 14:29:51 +01:00
|
|
|
rules: '{{ iptables_default_tail }}'
|
2018-07-06 23:18:11 +02:00
|
|
|
become: True
|
2019-01-12 14:29:51 +01:00
|
|
|
become_user: root
|