Files
Kamino/roles/ufw/tasks/install.yml
T
Defame1297 a9a973a523
Build / build (pull_request) Successful in 38s
Lint / lint (pull_request) Successful in 4m29s
Molecule / molecule (pull_request) Canceled after 1m14s
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
2026-11-29 17:10:25 +00:00

21 lines
835 B
YAML

---
- name: Install ufw
become: true
ansible.builtin.package:
name: "{{ ufw_package_name }}"
state: present
register: __ufw_install
# ansible_check_mode is not used: the play-level `check_mode: true` keyword does not set it inside
# include_role tasks. A command task is skipped in both forms, the same probe as tasks/sysctl.yml.
- name: Probe whether the run is in check mode
ansible.builtin.command: "true"
register: __ufw_install_probe
changed_when: false
# False only when a check-mode run would install ufw: the binary and /etc/ufw are then missing.
# Undefined when this file's tags are skipped; the guards then default it to true.
- name: Remember whether ufw can be configured
ansible.builtin.set_fact:
__ufw_can_configure: "{{ __ufw_install is not changed or __ufw_install_probe is not skipped }}"