test(roles): run molecule's check step before and after converge
Every role scenario with a converge now runs check right before it (a fresh host) and right after it (a configured host), and a script test fails a scenario without both. pihole and pve_lxc move their second check from after idempotence to after converge to match. The roles that failed under --check on a fresh host get the two allowed guards: cloudflared, docker, gitea, gitea_runner, traefik and user_management. ufw and fail2ban preview only a host where their package is installed, as their READMEs now say. Closes #134 Assisted-by: Claude Code
This commit is contained in:
1 parent
51b38211e7
commit
cf2286b7a7
56 files changed
+202
-35
No files matched your search
@@ -82,7 +82,7 @@ Main entry point: `fail2ban` (everything), `fail2ban_install`, `fail2ban_validat
|
||||
|
||||
## Tests
|
||||
|
||||
The scenario `molecule/default/` runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). The sequence runs prepare, converge, idempotence, side effect and verify; it has no check-mode step.
|
||||
The scenario `molecule/default/` runs in CI only, on two platforms: `${MOLECULE_IMAGE}` (Ubuntu 24.04) and `${MOLECULE_IMAGE_2604}` (Ubuntu 26.04). It runs `check` before the converge (a fresh host, where the image already has fail2ban installed) and after it (a configured host).
|
||||
|
||||
- Converge applies the main entry point with an extra `fail2ban_ignoreip` network and calls `service_jail` twice, one jail with a `logpath` and one with a `journalmatch`.
|
||||
- Converge also runs inputs that must be refused: a service filter without `failregex`, and a `fail2ban_ignoreip` entry with whitespace, a plain string instead of a list, and an entry starting with `;`. The `fail2ban_ignoreip` refusals are matched on their message.
|
||||
@@ -94,6 +94,7 @@ Not covered: no failure is sent through a jail, so a ban triggered by `failregex
|
||||
## Notes
|
||||
|
||||
- Idempotent: yes.
|
||||
- Check mode: `--check` previews a host where fail2ban is already installed; a play-level `check_mode: true` is not supported. On a host without fail2ban it fails at the configuration and service tasks: the package is not installed under `--check`, so `/etc/fail2ban`, `fail2ban-client` and the unit are missing.
|
||||
- `fail2ban_ignoreip` lives in the `[DEFAULT]` section of `jail.local`, so it also applies to the jails that `service_jail` writes to `jail.d`. The exemption only exists once the main entry point has written `jail.local` on that host: `service_jail` does not read `fail2ban_ignoreip`, so a host that uses only `service_jail` has none.
|
||||
- `fail2ban_ignoreip` replaces an `ignoreip` set in `jail.conf` or `jail.d/*.conf`, which Fail2Ban reads before `jail.local`; a `jail.d/*.local` file is read after it and can still override it for one jail. Entries must not contain whitespace, `;` or `%` (a `;` after whitespace starts a comment in Fail2Ban's config files and a `%` is interpolation syntax).
|
||||
- Prefer IP addresses and CIDR networks in `fail2ban_ignoreip`. Fail2Ban resolves a hostname when the jail starts, and a failed lookup leaves that entry ineffective with only a log warning. The validation of `fail2ban_ignoreip` runs under the `fail2ban_validate` tag, so `--tags fail2ban_configure` skips it.
|
||||
|
||||
Reference in new issue
Block a user