What is an Ansible playbook?
Quick Answer
A YAML file that defines automation as ordered plays and tasks — mapping host groups to the modules, variables, handlers, and roles that bring them to a desired state, idempotently.
Detailed Answer
Each play targets an inventory group and runs tasks that are idempotent module calls, so re-running converges rather than duplicating work. Handlers run only on change (e.g., restart nginx when config changes), variables and templates make it environment-aware, and roles package reusable logic. Playbooks are the readable, version-controlled unit of Ansible automation.
Interview Tip
Mention idempotency, handlers-on-change, and roles — the three things that make playbooks robust rather than just scripts.