Skip to content

Commit 0f7fe7f

Browse files
committed
mirror: fix firewalld status check to prevent spurious failures
The firewalld status check tasks in both linux-mirror and nix-cache-mirror roles were using ignore_errors which still caused tasks to be marked as FAILED when firewalld is inactive. On systems without firewalld or where it is not running, systemctl is-active returns exit code 4, which Ansible interprets as a failure even with ignore_errors set. Changed both tasks to use failed_when: false instead of ignore_errors. This tells Ansible the task cannot fail and prevents spurious FAILED markers in the output. The changed_when: false directive was already present in linux-mirror and has been added to nix-cache-mirror for consistency since checking service status does not modify system state. The downstream firewall rule tasks already have correct conditionals that check firewalld_status.stdout for active status, so they will only run when firewalld is actually active. Generated-by: Claude AI Link: https://patch.msgid.link/[email protected] Signed-off-by: Daniel Gomez <[email protected]>
1 parent 6b7027e commit 0f7fe7f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

playbooks/roles/linux-mirror/tasks/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,8 @@
359359
ansible.builtin.command:
360360
cmd: systemctl is-active firewalld
361361
register: firewalld_status
362-
ignore_errors: true
362+
failed_when: false
363363
changed_when: false
364-
failed_when: firewalld_status.rc not in [0, 3, 4] # rc=0 (active), rc=3 (inactive but not an error), 4 not present
365364
when:
366365
- not install_only_git_daemon|bool
367366
- linux_mirror_nfs | bool

playbooks/roles/nix-cache-mirror/tasks/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@
141141
- name: Check if firewalld is running
142142
ansible.builtin.command: systemctl is-active firewalld
143143
register: firewalld_status
144-
ignore_errors: true
144+
failed_when: false
145+
changed_when: false
145146
when:
146147
- install_nix_cache_mirror | bool
147148
- linux_mirror_nfs | bool

0 commit comments

Comments
 (0)