Skip to content

CICD-251 · Ansible check mode ​

Encyclopedia · Ansible and configuration management · All snippets

Previous · CICD-250 · Next · CICD-252

1. Where it fits ​

  • Placement CI run step.
  • Prerequisites controller with reviewed inventory, pinned Ansible collections and a non-production target.
  • Platforms local-linux, github-actions, gitea-actions.

2. Copy the snippet ​

bash
ansible-playbook -i inventory/staging.yml playbooks/site.yml --check --limit canary

3. How it works ​

The selected inventory and limit determine the hosts a playbook can affect. Syntax check and check mode give different forms of preflight evidence.

4. Verify the result ​

Check limited inventory first. Check-mode support varies by module and diffs can expose secrets.

Validation syntax-validated (Bash parse). Status definitions.