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
19 lines
602 B
YAML
19 lines
602 B
YAML
---
|
|
- name: Install UFW before.rules
|
|
become: true
|
|
ansible.builtin.template:
|
|
src: before.rules.j2
|
|
dest: /etc/ufw/before.rules
|
|
owner: root
|
|
group: root
|
|
mode: "0644"
|
|
notify: Reload UFW
|
|
when:
|
|
- ufw_enabled
|
|
- __ufw_can_configure | default(true)
|
|
# Not gated on ufw_aggregated_before_rules being non-empty: this template
|
|
# fully replaces the stock before.rules (unlike rules.yml, which only adds
|
|
# to it), and its unconditional loopback-ACCEPT block must always be
|
|
# deployed whenever UFW is enabled, even on hosts with no ufw_before_rules
|
|
# entries of their own.
|