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
30 lines
1.8 KiB
YAML
30 lines
1.8 KiB
YAML
---
|
|
# Included by converge.yml and verify.yml after each orphan_rules case. The counts are
|
|
# absolute: svc_o1 holds ufw_conv_o1_want rules (default ufw_conv_o1_initial: 2 before the
|
|
# purge, 0 after), and the tagged total is 20 plus those. The 20: svc_a 2, svc_b 2, svc_c 1,
|
|
# svc_e 2, svc_g 1, svc_h 2, svc_m 1, svc_o2 1, svc_o3 4 (kept orphans that may carry SSH),
|
|
# svc_p 4 (its desired rule and three kept stale rules).
|
|
- name: Read the rules ufw would load
|
|
ansible.builtin.command: ufw show added
|
|
register: ufw_conv_added
|
|
changed_when: false
|
|
environment: {LC_ALL: C}
|
|
|
|
# Under --check (molecule's check step) nothing was applied or purged, so the counts do not hold.
|
|
- name: The seeds are as this case leaves them
|
|
ansible.builtin.assert:
|
|
that:
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_o1:') | list | length == ufw_conv_o1_count | int
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_o2:3333333333') | list | length == 1
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_o3:555555555[1-4]') | list | length == 4
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_m:4444444444') | list | length == 1
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_p:666666666[123]') | list | length == 3
|
|
- ufw_conv_added.stdout_lines | select('search', 'svc_p:6666666664') | list | length == 0
|
|
- ufw_conv_added.stdout_lines | select('match', '^ufw ') | select('search', 'ansible-ufw') | list | length == 20 + ufw_conv_o1_count | int
|
|
- ufw_conv_added.stdout_lines | select('match', '^ufw ') | reject('search', 'ansible-ufw') | list | length == 5
|
|
fail_msg: "Unexpected rules after the orphan_rules case: {{ ufw_conv_added.stdout_lines }}"
|
|
quiet: true
|
|
vars:
|
|
ufw_conv_o1_count: "{{ ufw_conv_o1_want | default(ufw_conv_o1_initial) }}"
|
|
when: not ansible_check_mode
|