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:
Defame1297 committed 2026-11-26 10:11:54 +00:00
1 parent 51b38211e7
commit cf2286b7a7
56 files changed
+202 -35

No files matched your search

+6
View File
@@ -32,6 +32,7 @@
content: |
deb [arch={{ __docker_apt_arch }} signed-by={{ docker_keyring_path }}] {{ docker_repo_base_url }} {{ ansible_distribution_release }} stable
mode: "0644"
register: __docker_apt_source
tags: [docker, install]
- name: Install Docker Engine packages
@@ -40,7 +41,10 @@
name: "{{ docker_packages }}"
state: present
update_cache: true
register: __docker_packages
notify: Restart docker
# Under --check a new source line is only simulated, so apt would find no Docker package.
when: not ansible_check_mode or __docker_apt_source is not changed
tags: [docker, install]
- name: Enable and start Docker service
@@ -49,4 +53,6 @@
name: "{{ docker_service }}"
enabled: true
state: started
# Under --check on a host without the packages there is no unit to start yet.
when: not ansible_check_mode or (__docker_apt_source is not changed and __docker_packages is not changed)
tags: [docker, install]
+6 -1
View File
@@ -24,6 +24,8 @@
when:
- not (docker_remove | default(false) | bool)
- docker_update | bool
# Under --check a new source line is only simulated, so no package would have a candidate.
- not ansible_check_mode or __docker_apt_source | default({}) is not changed
tags: [docker, update]
- name: Add configured users to the docker group
@@ -33,7 +35,10 @@
groups: "{{ docker_group }}"
append: true
loop: "{{ docker_users }}"
when: not (docker_remove | default(false) | bool)
when:
- not (docker_remove | default(false) | bool)
# Under --check on a host without the packages the group does not exist yet.
- not ansible_check_mode or (__docker_apt_source | default({}) is not changed and __docker_packages | default({}) is not changed)
tags: [docker, configure]
- name: Install or remove the boot and shutdown units