Description
Servers configured by hand, one SSH session at a time, are a liability nobody can reproduce or trust. The one person who set it up is the only one who knows why it works, and the day they are out, a routine change takes the site down. Shell scripts feel like automation until you run one twice and it appends the line again, restarts a service that was fine, or dies halfway and leaves a box in a state no one can name. Ansible fixes this by describing the state you want instead of the steps to get there, but that idea only pays off when you actually understand it. A playbook that is not idempotent is just a slower shell script with more YAML. The real skill is writing tasks that are safe to run again, reading what a run will change before it changes it, structuring roles so automation is reusable instead of copy-pasted, keeping secrets out of the repo, and rolling a change across a whole fleet without taking all of it down at once.
This book teaches you to automate real infrastructure with Ansible, safely, across a fleet, without learning the painful parts on production. It starts from the idea most tutorials skip: Ansible works because you declare the state you want, not the commands to reach it, and the whole payoff, running the same automation a hundred times and getting the same result, lives in one word, idempotency. It builds from your first inventory and playbook through the discipline that keeps you safe: writing tasks that are safe to run again, reading a run in check mode so you see the diff before you apply it, and structuring variables, templates, and roles so your automation is reusable instead of copy-pasted into every project. Then it covers what real use demands: keeping secrets out of the repo with Vault, reacting to change with handlers and conditionals, and proving a role works with Molecule before it ever touches a real host. The fleet chapters are where teams actually get hurt: running across hundreds of hosts without hammering them all at once, rolling updates so a bad change stops at the first batch instead of the whole fleet, delegating tasks, and running Ansible in CI so infrastructure changes are reviewed like code. It closes on the discipline of a safe change, the blast radius of a play, and treating a fleet-wide run with the same care as a database migration. The examples are real automation, shown written badly and then well. For engineers who want infrastructure they can reproduce, review, and run without holding their breath.
Written for you if
This book is for: engineers who keep their infrastructure alive with SSH, shell scripts, and a runbook in their head, and who want to automate it as code that is reproducible, reviewable, and safe to run on production, without learning the hard way by breaking a fleet.
The system inside
The 7 Steps to Stop Fighting Fires and Get Your Nights Back. The method that turns servers you keep alive by hand into infrastructure you automate as code, reproducible and safe to run on a whole fleet. Instead of shell scripts you pray over and a runbook only one person understands, you learn to declare the state you want, write automation that is safe to run again, see exactly what a run will change before it changes it, and roll a change across hundreds of hosts without taking them all down at once. Go from the engineer who SSHes in and hopes to the one whose fleet is described in code anyone on the team can read, review, and run.
- Describe the fleet
- Write the playbook
- Make it idempotent
- Structure it in roles
- Keep the secrets out
- Prove it before prod
- Roll it out at scale
Everything inside
- Chapter 1: The day a routine change took the whole site down
- Chapter 2: Writing down the fleet so it stops living in one person’s head
- Chapter 3: From a runbook you follow by hand to one that runs itself
- Chapter 4: How to run the same playbook a hundred times without breaking anything
- Chapter 5: One playbook, many servers, and not a single hardcoded value
- Chapter 6: Turn the playbook only you understand into a role anyone can run
- Chapter 7: One grep through the repo, and there’s the production password
- Chapter 8: Before this play touches production, make it tell you what it will change
- Chapter 9: Prove the role works on a box you can throw away, not on production
- Chapter 10: Stop restarting a service that was already fine
- Chapter 11: The run that changed the whole fleet in a blink
- Chapter 12: The bad change that stopped at the first ten servers
- Chapter 13: The day no one on the team is the only one who knows


