fix(ufw, fail2ban): --check passes on a host without the package #478
Notifications
Due Date
No due date set.
Blocks
Reference: Mortis/Kamino#478
Reference in new issue
Block a user
Part of #419
Problem
On a host where
ufworfail2banis not installed yet,ansible-playbook --checkwith either role fails. The package task only reportschangedin check mode, so the tasks after it run against a missing binary, a missing config directory or a missing systemd unit. Both READMEs document this as a limit (the ufw and fail2ban READMEs, "check mode" notes). It has to be fixed before #435 removes the baked packages from the molecule images: the scenarios runcheckbeforeconverge, so their first check would then fail.Proposal
__ufw_installor__fail2ban_install.roles/AGENTS.mddescribes. That covers config templates, the ufw module, the systemd service,flush_handlers, validation commands, the jail tasks and the handlers.not ansible_check_mode or <install is not changed>guard.ansible_check_mode, because that variable is not set for a play-levelcheck_mode: trueinsideinclude_role.check-absent, runsdependency,create,prepareandcheck, with nodestroy. Its prepare purges ufw and refreshes the APT cache.Acceptance criteria
check-absentscenario passes in CI:--checksucceeds on a host without ufw (Molecule check).--checkfails without the package (review).changelogs/fragments/, andpre-commit run --all-filespasses.python3 -m unittest discover -s tests/scriptspasses, including the scenario-structure tests for the new scenario.Assisted-by: Claude Code