Ansible Mastery Path¶
Most Ansible problems are not exotic. A playbook that is green because it never changed anything. A command task that reports changed on every run. A removed task that leaves the old configuration on every server. Two roles that fight over one file and never converge. A --limit that matches nothing and exits zero. A rolling update whose failure budget silently stops working. None of these are bugs in the tool. They follow from how Ansible actually works, and this course shows each one, with an experiment or a test wherever it could be run.
It assumes you can use a terminal and edit YAML. It doesn't assume any automation experience.
Level 1 is the foundation: what Ansible is, ad-hoc commands, inventory, playbooks, idempotency and check mode, variables and facts, conditionals and loops, templates and handlers, debugging, ending with a tested baseline playbook. Level 2 adds structure and safety: roles, a measured variable-precedence table, Jinja2 filters, error handling, Vault, collections, tags and limits, delegation and batches, linting and testing, ending with a tested role. Level 3 extends Ansible: custom modules and plugins, dynamic inventory, command and shell pitfalls, async, performance, rolling updates, drift and convergence, network and Windows targets, ending with a tested module. Level 4 is operations: controllers and execution environments, CI, secrets, pull mode, Terraform together with Ansible, drift audits, incidents, migration, governance and a fleet capstone.
Every lesson has a How It Actually Works section: why a second run is the best test you can write, why -e beats every other variable, why a handler can be skipped after a failure, why lookup() joins a list into one string, and why check mode cannot see what command does.
Read this first: what was actually run
This course was written on a Mac with ansible-core 2.21.5 (Python 3.14.7) and no remote servers, SSH targets, Windows hosts, network devices, container runtime or automation controller. Every playbook shown with output was run with the real ansible-playbook, but all "servers" use ansible_connection=local and are directories under a sandbox. What that means:
- Run and measured: the playbook language, modules for files, templates and lines, variables and precedence (14 sources ranked by experiment), handlers, roles, blocks and rescue, Vault with real encryption, tags and limits,
serialand failure budgets, delegation,ansible-lint, custom modules and plugins, dynamic inventory (script and plugin), async, forks and fact-gathering timings,ansible-pullagainst a local Git repository, callback plugins, andansible-builder(build context only). - Tested code: 130 pytest tests that run the real Ansible: a baseline playbook, a role, two modules, filter/lookup/inventory plugins, a rolling-update playbook, a drift auditor, a
no_loglinter, a Terraform-output inventory script (on a hand-written fixture), a preflight guard and a 12-node fleet capstone. - Described, not run: SSH and
become, Linux packages andsystemd, Windows and network targets (their collections were installed only to read documentation), AWX/AAP, container builds, GitHub Actions, Terraform, secret managers, Molecule. These come from docs.ansible.com and general knowledge as read in October 2026 and are marked "not run".
Where an experiment surprised me (a boolean string that is now an error, an always: block that defeated max_fail_percentage, an async timeout reported as "unparsable results", a guard that approved the case it was meant to block), the lesson says so rather than inventing a clean story. Behaviour changes between Ansible versions; check yours with ansible --version.
How the program is organized¶
| Level | Focus | Modules | What you can do after |
|---|---|---|---|
| 1 · Ansible Foundations | Inventory, playbooks, idempotency, variables, loops, templates, handlers, debugging | 10 | Write and verify a playbook that converges |
| 2 · Structure and Safety | Roles, precedence, filters, errors, Vault, collections, targeting, testing | 10 | Build reusable, tested automation |
| 3 · Extending Ansible | Modules, plugins, dynamic inventory, async, performance, rolling updates, drift | 10 | Extend Ansible and roll out changes safely |
| 4 · Operating Ansible | Controllers, CI, secrets, pull mode, Terraform, audits, incidents, governance | 10 | Run automation as a team service |
Each level has 9 teaching modules plus a hands-on project (module 10), for 40 lessons total.
How to use this site¶
- Get something to practise on: two small VMs or containers you can break, or just use
connection: localand a sandbox directory as this course does. Never experiment on machines you care about. - Read the "what was run" note at the top of each lesson: it tells you whether an output was observed, modelled, or described from documentation.
- Run the code in the
src/folder of the course repository (see its README):pytestruns 130 tests against real Ansible. - Run every playbook twice. The second run is the lesson.
- Do the exercises, especially "predict, then run".
More from the Mastery Path series¶
Free, structured, module-wise training across 97 other languages, platforms and disciplines — expand a category to browse: