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
@@ -14,6 +14,12 @@
|
||||
- item.state | default('present') == 'present'
|
||||
- not item.system | default(false)
|
||||
|
||||
# Under --check a user the role would create does not exist yet, and authorized_key fails on a missing user.
|
||||
- name: Read the existing users for the check-mode preview
|
||||
ansible.builtin.getent:
|
||||
database: passwd
|
||||
when: ansible_check_mode
|
||||
|
||||
- name: Enforce authorized_keys authoritatively
|
||||
become: true
|
||||
ansible.posix.authorized_key:
|
||||
@@ -25,5 +31,6 @@
|
||||
when:
|
||||
- item.state | default('present') == 'present'
|
||||
- ( user_management_default_authorized_keys + (item.authorized_keys | default([])) ) | length > 0
|
||||
- not ansible_check_mode or item.name in ansible_facts.getent_passwd
|
||||
loop_control:
|
||||
label: "{{ item.name }}"
|
||||
Reference in new issue
Block a user