Check Mode
Cheat sheet · https://pcornel.dk/topic.php?topic=5413
Answer
Ansible check mode asks supported content to predict changes without applying them, providing planning evidence whose accuracy depends on module/plugin support and observable current state.
Remember
- Check mode ok ≠ real run guaranteed; external APIs, generated data and unsupported modules can behave differently.
- changed prediction ≠ actual change applied; check mode normally does not mutate target state.
- No predicted change ≠ target healthy; the task may validate only a narrow resource boundary.
- Module supports check mode ≠ every dependent role/task is simulation-safe.
First checks
ansible-playbook site.yml --check --diff— dry run- check_mode: false for read-only commands — make checks work
- Modules without check mode support — limitations
Verify in this order
playbook → check mode → predicted changes
Where it usually breaks
Check mode proves what supported content predicts from observable state; it does not prove the real execution will succeed or produce identical results.
Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.
Check Mode Ansible boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Inputs / selection | Correct inventory, hosts, variables/facts and content are explicit | Wrong scope, stale facts, hidden precedence or content-version drift |
| Execution | Connection, privilege, module/task context and ordering match intent | Unreachable, wrong execution host, privilege/plugin failure or misleading skip/change state |
| Result semantics | Per-host/item results are preserved and interpreted correctly | Aggregate recap hides partial/skipped/handled failures |
| Target proof | Resource/workload read-back and rerun confirm convergence | Green Ansible status treated as end-to-end acceptance |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5413