Member-only story
Ansible Boot Camp 4 — Playbooks
Ansible boot camp series
What is Ansible Playbook
Playbook is Ansible’s metaphor to describe its configuration files. Ansible Playbooks offer a repeatable, re-usable, simple configuration management and multi-machine deployment system.
Playbooks contain a list of tasks (plays) in an order they should get executed against a set of hosts or a single host based on the configuration specified. Playbooks are written in YAML format and may be included within other playbooks.
In Ansible, whenever you have the need to run a task with more than once, you should create a playbook and version control it.
You can achieve the following three things with playbook:
- Declare infrastructure/app configurations
- Orchestrate steps of any manual process on multiple servers in order
- Launch tasks synchronously or asynchronously
Compare to Ansible Ad-hoc comments, you can organize multiple commands, modules and handlers into a single playbook. For example: