Skip to content

Commit

Permalink
Merge pull request #43 from brianhartsock/fix_check_mode
Browse files Browse the repository at this point in the history
Fix check mode on handler
  • Loading branch information
brianhartsock authored Feb 6, 2025
2 parents 8f1f36c + 6b8c357 commit 4032503
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
1 change: 1 addition & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
ansible.builtin.service:
name: avahi-daemon
state: restarted
when: 'not ansible_check_mode'
5 changes: 5 additions & 0 deletions molecule/check_mode/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- name: Converge
hosts: all
roles:
- role: brianhartsock.avahi
41 changes: 41 additions & 0 deletions molecule/check_mode/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
flake8
platforms:
# Only worry about noble for check mode since there is no difference in playbooks
- name: noble
image: geerlingguy/docker-ubuntu2404-ansible:latest
command: ""
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
pre_build_image: true
provisioner:
name: ansible
options:
check: true
verifier:
name: testinfra
scenario:
test_sequence:
- dependency
- cleanup
- destroy
- syntax
- create
- prepare
- converge
# Skipping idempotence since it is check_mode
# idempotence
- side_effect
- verify
- cleanup
- destroy
8 changes: 8 additions & 0 deletions molecule/check_mode/prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Prepare
hosts: all
check_mode: false
tasks:
- name: Update apt cache.
ansible.builtin.package:
update_cache: true
5 changes: 5 additions & 0 deletions molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ dependency:
name: galaxy
driver:
name: docker
lint: |
set -e
yamllint .
ansible-lint
flake8
platforms:
- name: focal
image: geerlingguy/docker-ubuntu2004-ansible:latest
Expand Down

0 comments on commit 4032503

Please sign in to comment.