Skip to content

Commit 0a8d3c2

Browse files
committed
refactor: Explicitly set permanent firewall configuration
When neither `permanent` nor `runtime` is set, the firewall role normally defaults to `runtime` only. Inexplicably it seems to set the permanent configuration as well, but let's not rely on this and instead make this explicit.
1 parent 24438d7 commit 0a8d3c2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tasks/firewall.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
vars:
77
_cockpit_port: "{{ cockpit_port if cockpit_port is not none else 9090 }}"
88
_cockpit_port_proto: "{{ _cockpit_port }}/tcp"
9-
firewall: "{{ [{'service': 'cockpit', 'state': 'enabled'}]
10-
if (_cockpit_port | int) == 9090 else
11-
[{'port': _cockpit_port_proto, 'state': 'enabled'}] }}"
9+
firewall:
10+
permanent: true
11+
runtime: true
12+
state: enabled
13+
service: "{{ 'cockpit' if (_cockpit_port | int) == 9090 else omit }}"
14+
port: "{{ _cockpit_port_proto if (_cockpit_port | int) != 9090 else omit }}"
1215
when:
1316
- cockpit_manage_firewall | bool
1417
- ansible_facts['os_family'] == 'RedHat' or ansible_facts['os_family'] == 'Suse'

0 commit comments

Comments
 (0)