add default values for iptables rules state

This commit is contained in:
Robert Kaussow 2019-10-30 22:36:33 +01:00
parent 2bf7db0571
commit d31c9066a3

View File

@ -3,23 +3,23 @@
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) }}'
loop: '{{ iptables_custom_rules }}'
name: "iptables_custom_rules_{{ item.name }}"
rules: "{{ item.rules }}"
state: "{{ item.state | default('present') }}"
weight: "{{ item.weight | default(omit) }}"
table: "{{ item.table | default(omit) }}"
loop: "{{ iptables_custom_rules }}"
loop_control:
label: "{{ item.name }}"
- 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 }}'
name: "{{ item.name }}"
rules: "{{ item.rules }}"
state: "{{ item.state | default('present') }}"
weight: "{{ item.weight | default(omit) }}"
table: "{{ item.table | default(omit) }}"
loop: "{{ iptables_app_rules + iptables_app_rules_extra }}"
loop_control:
label: "{{ item.name }}"
@ -27,16 +27,16 @@
iptables_raw:
name: iptables_default_head
weight: 10
keep_unmanaged: '{{ iptables_keep_unmanaged }}'
keep_unmanaged: "{{ iptables_keep_unmanaged }}"
state: present
rules: '{{ iptables_default_head }}'
rules: "{{ iptables_default_head }}"
- name: Set default iptables tail rules
iptables_raw:
name: iptables_default_tail
weight: 99
keep_unmanaged: '{{ iptables_keep_unmanaged }}'
state: '{{ (not iptables_default_tail) | ternary("absent", "present") }}'
rules: '{{ iptables_default_tail }}'
keep_unmanaged: "{{ iptables_keep_unmanaged }}"
state: "{{ (not iptables_default_tail) | ternary('absent', 'present') }}"
rules: "{{ iptables_default_tail }}"
become: True
become_user: root