2017-05-17 22:54:43 +00:00
|
|
|
---
|
2018-07-06 21:18:11 +00:00
|
|
|
- name: Setup iptables
|
|
|
|
block:
|
|
|
|
- name: Set custom iptables rules
|
|
|
|
iptables_raw:
|
|
|
|
name: 'iptables_custom_rules_{{ item.name }}'
|
|
|
|
rules: '{{ item.rules }}'
|
|
|
|
state: '{{ item.state }}'
|
|
|
|
weight: '{{ item.weight|default(omit) }}'
|
|
|
|
table: '{{ item.table|default(omit) }}'
|
|
|
|
with_items: '{{ iptables_custom_rules }}'
|
|
|
|
loop_control:
|
|
|
|
label: "{{item.name}}"
|
|
|
|
tags: iptables
|
2017-05-17 22:54:43 +00:00
|
|
|
|
2018-07-06 21:18:11 +00: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 }}'
|
|
|
|
tags: iptables
|
2017-07-13 19:27:26 +00:00
|
|
|
|
2018-07-06 21:18:11 +00:00
|
|
|
- name: Set default iptables tail rules
|
|
|
|
iptables_raw:
|
|
|
|
name: iptables_default_tail
|
|
|
|
weight: 99
|
|
|
|
keep_unmanaged: '{{ iptables_keep_unmanaged }}'
|
|
|
|
state: '{{ (iptables_default_tail != "" ) | ternary("present", "absent") }}'
|
|
|
|
rules: '{{ iptables_default_tail }}'
|
|
|
|
tags: iptables
|
|
|
|
become: True
|