0Pricing
Ansible Academy · Lesson

Check Mode: Dry-Run with --check

Preview changes without applying them.

Check Mode: Dry-Run with --check is a free Ansible Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ansible Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

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 --check

changed 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 --diff

Not 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: false

Force 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. 🔍

Frequently asked questions

Is the “Check Mode: Dry-Run with --check” lesson free?

Yes — the full text of “Check Mode: Dry-Run with --check” is free to read here on the web, and the Ansible Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ansible Academy course, upgrade to CoddyKit PRO.

What will I learn in “Check Mode: Dry-Run with --check”?

Preview changes without applying them. You practise Ansible Academy 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 Ansible Academy?

No prior experience is required. Ansible Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

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 Ansible Academy lesson?

Yes. Every Ansible Academy 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

  1. Desired State, Not Step-by-Step Scripts
  2. Reading changed vs ok in Output
  3. Why command Breaks Idempotency
  4. Check Mode: Dry-Run with --check
← Back to Ansible Academy