Skip to content

Commit 1fc829c

Browse files
committed
fix: ensure firewalld is responding to requests after starting
Cause: The firewalld can be slow to start up on some platforms. Consequence: The firewall module can be called before the server is responding and will raise an error if it cannot connect to the firewall daemon. Fix: Ensure that firewall-cmd --state returns "running" before calling the module. Result: The firewall role works even if the server is slow to startup. Signed-off-by: Rich Megginson <rmeggins@redhat.com>
1 parent c7b2d11 commit 1fc829c

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@
4040
state: "{{ 'started' if __firewall_is_booted else omit }}"
4141
check_mode: "{{ __firewall_test_check_mode | d(ansible_check_mode) }}"
4242

43+
- name: Check if firewalld is responding to dbus requests
44+
# noqa command-instead-of-module
45+
command: firewall-cmd --state
46+
register: __firewall_cmd_state
47+
changed_when: false
48+
until: __firewall_cmd_state.stdout | trim == "running"
49+
when: __firewall_is_booted
50+
check_mode: false # firewall_lib uses firewalld in check mode
51+
4352
- name: Configure firewall and/or gather facts
4453
vars:
4554
firewall_config_list: "{{ firewall is mapping | ternary([firewall], firewall) | list

0 commit comments

Comments
 (0)