fix(ufw, fail2ban): keep the check-mode guard out of vars and test service_rules
vars/ holds constants only, so ufw's __ufw_can_configure is now a set_fact after the install probe; the guards default it to true when the install tasks were skipped by tags. service_rules already skips its reconcile when `ufw status` fails under check mode; the ufw check-absent scenario now calls it so CI holds that. The fail2ban service jail task's tags sit with the task again, above the comment of the configuration test. Refs #478 Assisted-by: Claude Code
This commit is contained in:
1 parent
924a0ea7a7
commit
a9a973a523
9 files changed
+29
-13
No files matched your search
@@ -47,11 +47,10 @@
|
||||
mode: "0644"
|
||||
notify: Reload Fail2Ban
|
||||
when: not ansible_check_mode or __fail2ban_install | default({}) is not changed
|
||||
tags: [fail2ban, fail2ban_service_jail]
|
||||
|
||||
# Read-only, so it also runs in check mode. A failure leaves the broken file on
|
||||
# disk and fails every run until fixed, instead of only the run that wrote it.
|
||||
tags: [fail2ban, fail2ban_service_jail]
|
||||
|
||||
- name: Test Fail2Ban configuration
|
||||
become: true
|
||||
ansible.builtin.command: fail2ban-client -t
|
||||
|
||||
Reference in new issue
Block a user