xoxys.iptables/tasks/config.yml

32 lines
1001 B
YAML
Raw Normal View History

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