Check Mode: Dry-Run with --check
Preview changes without applying them.
Check Mode: Dry-Run with --check is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 4 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.
Preview Before You Apply
Sometimes you want to know what a playbook would change before it touches anything. Check mode gives you that safe preview.
Run with --check
Add --check to ansible-playbook for a dry run. Ansible reports what it would do but makes no real changes on the hosts.
ansible-playbook site.yml --checkchanged Means Would Change
In check mode, a changed status means 'this task would change the host'. It is a prediction, not an action that happened.
Powered by Idempotency
Check mode works because idempotent modules already compare current state to desired state. It simply reports the diff and stops short of acting.
Add --diff for Detail
Pair check with --diff to see line-by-line changes to files and templates, like a git diff of what the run would write.
ansible-playbook site.yml --check --diffNot Every Module Supports It
Some modules cannot simulate their work. Raw command and shell are skipped in check mode by default, since they cannot predict a result.
Force a Task to Always Run
Set check_mode: false on a task to run it for real even during a dry run, handy for read-only commands that gather data.
ansible.builtin.command: get_facts.sh
check_mode: falseForce a Task to Always Simulate
The opposite, check_mode: true, makes a task always simulate, even on a normal run. Useful to keep a risky task preview-only.
Watch for False Results
A dry run can mislead when a later task depends on an earlier one that was only simulated. The chain may not reflect reality.
Great for Reviewing Drift
Run --check on a stable host to detect drift: any reported change means something on the server no longer matches your playbook.
Safe to Use in Production
Because it changes nothing, --check is safe to run against production at any time to audit what a deploy would do first.
Quick Check
You run ansible-playbook site.yml --check against a live server before deploying.
Recap
Use --check for a safe dry run and --diff to see the details. It predicts changes, helps spot drift, and never touches your hosts. 🔍
Learn DevOps Bootcamp with an AI tutor — free
Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.
- Courses
- 142
- Lessons
- 568
Frequently Asked Questions
Is the “Check Mode: Dry-Run with --check” lesson free?
Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Check Mode: Dry-Run with --check”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.
What will I learn in “Check Mode: Dry-Run with --check”?
Preview changes without applying them. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start DevOps Bootcamp?
No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.
How long does the “Check Mode: Dry-Run with --check” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this DevOps Bootcamp lesson?
Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Desired State, Not Step-by-Step Scripts
- Reading changed vs ok in Output
- Why command Breaks Idempotency
- Check Mode: Dry-Run with --check