0Pricing
Ansible Academy · Lesson

Gated Deploys with Approvals & Check Mode

Promote changes through environments.

Gated Deploys with Approvals & Check Mode 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.

Not Every Push to Prod

Continuous delivery is great, but production deserves a pause. A gate lets you preview and approve before changes go live. 🚦

Preview with Check Mode

Run the play in --check mode first: Ansible reports what would change without actually changing anything.

ansible-playbook site.yml --check

See the Exact Diff

Pair check mode with --diff so the pipeline log shows the precise file edits a real run would make.

ansible-playbook site.yml --check --diff

Promote Through Environments

Send changes to staging first, verify there, then promote the very same playbook to production once it passes.

GitHub Environments Add Rules

A GitHub environment like production can require reviewers, so a job targeting it waits for a human to approve.

jobs:
  deploy:
    environment: production

Required Reviewers

Configure required reviewers on that environment; the deploy job pauses until one of them clicks approve in the UI.

Stage the Plan as an Artifact

Save the check-mode diff output as a build artifact so reviewers read exactly what they are signing off on.

- uses: actions/upload-artifact@v4
  with:
    path: plan.txt

Split Plan and Apply Jobs

Make the apply job depend on the plan job with needs, so nothing applies until the preview job succeeds.

apply:
  needs: plan
  environment: production

Mind Check-Mode Gaps

Some tasks cannot fully simulate in check mode. Mark those with check_mode: false so they are skipped during a dry run.

- command: /usr/bin/report
  check_mode: false

Roll Out in Waves

On approval, use serial to deploy in small batches, so a bad change hits only a few hosts before you can stop.

- hosts: web
  serial: 2

Leave an Audit Trail

The approval click, the plan artifact, and the run log together form an audit trail of who shipped what, and when.

Quick Check

How do you preview a production change before applying it?

Recap: Approve, Then Apply

You gated deploys: preview with check mode and diff, require reviewers on the environment, then roll out in safe serial waves. 🛡️

Frequently asked questions

Is the “Gated Deploys with Approvals & Check Mode” lesson free?

Yes — the full text of “Gated Deploys with Approvals & Check Mode” 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 “Gated Deploys with Approvals & Check Mode”?

Promote changes through environments. 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 “Gated Deploys with Approvals & Check Mode” 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. ansible-lint as a Quality Gate
  2. Run Playbooks in GitHub Actions
  3. Vault Secrets in a Pipeline
  4. Gated Deploys with Approvals & Check Mode
← Back to Ansible Academy