DevOps Bootcamp · Lesson

Run It with ansible-playbook

Execute and read the play output.

Lesson 3 of 413 steps

Run It with ansible-playbook is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 3 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.

The ansible-playbook Command

You run a playbook with the ansible-playbook command, not plain ansible. Pass it the YAML file you want to execute.

ansible-playbook site.yml

Point It at Your Inventory

Use -i to choose which inventory file lists your hosts. Without it, Ansible falls back to its default inventory.

ansible-playbook -i inventory.ini site.yml

Gathering Facts First

The first thing you see is the Gathering Facts task. Ansible collects details about each host before running your tasks.

TASK [Gathering Facts] *********

Reading the Task Lines

Each task prints a status per host. You will see ok, changed, or failed, telling you exactly what happened.

TASK [start nginx] *********
changed: [web1]

ok Means No Change

A green ok means the host was already in the desired state. Ansible checked it and decided nothing needed to change.

changed Means It Acted

A yellow changed means Ansible actually altered the host to match what you asked for. That is real work being done.

The PLAY RECAP

At the end, the PLAY RECAP summarizes every host: how many tasks were ok, changed, unreachable, or failed.

PLAY RECAP *********
web1 : ok=2 changed=1 failed=0

failed and unreachable

A nonzero failed means a task errored on that host. unreachable means Ansible could not even connect over SSH.

Add Verbosity With -v

Stuck on an error? Add -v for more detail. Stack more v's, up to -vvvv, to see ever deeper debugging output.

ansible-playbook site.yml -vv

Syntax Check Before You Run

Catch YAML mistakes early with --syntax-check. It parses the playbook without touching any host.

ansible-playbook site.yml --syntax-check

Limit to One Host

Testing on a single machine first? Use --limit to run the play against just one host before rolling it out wide.

ansible-playbook site.yml --limit web1

Quick Check

A task shows changed on a host. What does that mean?

You Can Run and Read Plays

You now launch playbooks with ansible-playbook and read the recap. ok, changed, and failed tell the whole story. ✅

Free to start

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 “Run It with ansible-playbook” lesson free?

Yes — any 3 lessons of the DevOps Bootcamp learning path, including “Run It with ansible-playbook”, 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 “Run It with ansible-playbook”?

Execute and read the play output. 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 3 of 4.

How long does the “Run It with ansible-playbook” 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

  1. YAML Syntax You Need for Ansible
  2. From Ad-Hoc to a Repeatable Playbook
  3. Run It with ansible-playbook
  4. Install Nginx in Five Lines
← Back to DevOps Bootcamp