Files
Kamino/roles/ufw/molecule/check-absent/converge.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

27 lines
947 B
YAML

---
# Run only under --check (the check step): ufw is not installed, so the tasks that need it skip.
- name: Converge on a host without ufw
hosts: all
# The role reads no facts; ufw_ssh_port defaults from ansible_port.
gather_facts: false
roles:
- role: mortis.kamino.ufw
vars:
ufw_rules:
- {rule: allow, port: 22, proto: tcp, comment: ssh}
- {rule: allow, port: 8080, proto: tcp, comment: web}
# The entry point a service role calls: its `ufw status` read fails on this host, so it must skip.
- name: Converge the rules of a service on a host without ufw
hosts: all
gather_facts: false
tasks:
- name: Rules of one service through the entry point
ansible.builtin.include_role:
name: mortis.kamino.ufw
tasks_from: service_rules
vars:
ufw_service_name: svc_a
ufw_service_rules:
- {rule: allow, port: 8001, proto: tcp, comment: alpha web}