xoxys.iptables/tasks/config.yml
2018-07-06 23:18:11 +02:00

34 lines
987 B
YAML

---
- 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
- 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
- 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