Ansible¶
Ansible lets you describe the state a machine should be in — packages installed, files in place, services running — and repeatedly converge real machines toward that state over SSH, with nothing installed on them beforehand. This is a hands-on guide to using it well: writing production playbooks, understanding what's happening underneath them, debugging what breaks, and building your own modules and collections when nothing built-in fits.
It's built to work two ways: read it start to finish as a course, or jump straight to the one page that answers what you need right now.
Start Here, Based on Where You Are¶
| You are... | Start at |
|---|---|
| New to Ansible entirely | Getting Started |
| Comfortable with the basics, want the daily-driver skills | Core Concepts |
| Writing playbooks already, want to level up | Playbook Engineering, Modules |
| Managing a large fleet, run times are slow | Advanced Execution |
| Setting up a real project from scratch | Production Engineering |
| Extending Ansible — a custom module or collection | Build Your Own |
| Evaluating or administering Red Hat AAP / AWX | Enterprise Platform (AAP & AWX) |
| Something's broken right now | Troubleshooting |
| Prepping for an Ansible or DevOps interview | Interview Preparation |
| Already know Ansible, need a fast lookup | Quick Reference |
The Learning Path¶
flowchart TD
A[Getting Started] --> B[Core Concepts]
B --> C[Variables & Data / Jinja2]
C --> D[Modules / Playbook Engineering]
D --> E[Roles / Collections]
E --> F[Advanced Execution /\nProduction Engineering]
F --> G[Build Your Own\nModules & Collections]
G --> H[Interview Preparation]
Learn by Building¶
Each project uses only what the previous ones already taught you. Skip ahead if you're already past a stage.
- Ping three servers — Your First Playbook
- Install and start nginx idempotently — Idempotency, Modules
- Create users with individual SSH keys — Case Study: User and SSH Access
- Deploy a templated config file — Templates for Config Generation
- Package it as a role — Role Structure
- Split dev/staging/production cleanly — Case Study: Multi-Environment Inventory
- Roll out a change with a canary batch — Case Study: Rolling Nginx Deployment
- Encrypt a secret with Vault — Secrets and Vault
- Add CI linting and a
--checkgate — CI/CD and Linting - Write a custom module — Build a Custom Module
- Package it into a collection — Build a Collection From Zero
- Tune a slow playbook at scale — Forks, Serial, Strategy, and Throttle, Performance
Every Section¶
- Getting Started — history and origins, installation, SSH, your first connection and playbook
- Core Concepts — inventory, modules, variables, conditionals, loops, handlers, idempotency
- YAML & Execution Model — what actually happens between YAML and remote execution
- Variables & Data — every variable source, and the full precedence order
- Jinja2 & Templates — expressions, filters, and real config generation
- Modules — command vs. shell, decision trees, module-by-category reference
- Playbook Engineering — blocks, error handling, imports vs. includes, delegation
- Advanced Execution — forks, strategy, fact caching, dynamic inventory
- Roles — structure, interfaces, production design
- Collections — structure, installing, publishing
- Build Your Own — writing a module, building a collection from zero
- Production Engineering — project layout,
ansible.cfg, security, performance, CI/CD, testing - Enterprise Platform (AAP & AWX) — ansible-core vs. ansible vs. AWX vs. AAP, Controller, Mesh, licensing
- Case Studies — full worked deployments, including the failure paths
- Troubleshooting — a real debugging methodology, not just a symptom list
- Interview Preparation — by subject and by level, tied back to the concepts
- Quick Reference — cheat sheets, no prose