Chapter 11: Ansible Introduction
11.12 Lab — playbook installs Nginx welcome
Lab
Automate a welcome page for badge API with Ansible.
- Pick one lab VM you can SSH into (from AWS course labs or local).
- Write inventory with that host in group
badge-api_web. ansible -m pingsucceeds.- Write
playbooks/web_welcome.yml(package + copy index + service). - Run
ansible-playbook; curl the web shop counter from your allowed IP. - Run playbook again; note
changed=0(or only expected changes) in the recap. - Optional: convert tasks into
roles/web_welcomeand call the role. - Commit playbook + inventory example (no real private keys, no production IPs you care about leaking). Use a sanitized
hosts.example.ini.
Practice task
Explain idempotence to a teammate in four sentences using the "run Nginx playbook twice" story.