Chapter 11: Ansible Introduction
11.1 Why Ansible — one playbook for many servers
You already automated one machine with Bash (Chapter 5). When you must configure many VMs the same way — users, packages, config files, services — copy-pasting SSH sessions breaks down.
Ansible is an agentless automation tool (SSH to Linux targets is the common beginner path). You write YAML playbooks that declare desired state; modules do the work.
Why it matters for an Instagram-style badge API : opening a second and third lab server should not mean retyping twenty apt/yum commands. One playbook installs Nginx, drops a welcome index.html, and enables the service.
| Bash script | Ansible playbook |
|---|---|
| Imperative steps you invent | Modules with consistent options |
| Easy to forget "already installed?" | Idempotent modules skip no-ops |
| Harder multi-host inventory | Inventory groups + parallel SSH |
We will not re-teach EC2 launch, Security Groups design, VPC or DNS — use a VM you already have from the AWS Cloud course (or a local VM). Ansible only configures what is already reachable over SSH.
Ravindra Bagale's Tip
Playbook root ne andazane chalavoo nako. become: true clear liha; kontya tasks elevate kartat te review kara. Lakshat theva!