BACKGROUND IMAGE: iSTOCK/GETTY IMAGES
An Ansible playbook is an organized unit of scripts that defines work for a server configuration managed by the automation tool Ansible.
Ansible is a configuration management tool that automates the configuration of multiple servers by the use of Ansible playbooks. The playbook is the core component of any Ansible configuration. An Ansible playbook contains one or multiple plays, each of which define the work to be done for a configuration on a managed server. Ansible plays are written in YAML. Every play is created by an administrator with environment-specific parameters for the target machines; there are no standard plays.
Ansible plays are flexible due to modules, which pertain to various aspects of the target managed servers. The module script written in Ruby. Modules exist for many parts of system configuration, including software installation and user management. Ansible, a Red Hat company, provides many modules, as does the open source community that uses and supports Ansible.
The playbook is therefore composed of plays, which are composed of modules. It executes when the administrator runs the ansible-playbook command against target machines. The administrator must use an inventory file to specify the hosts under the playbook's management. The inventory file contains a list of all hosts that are managed by Ansible, and it offers an option to group hosts according to their functionality. For example, an administrator can apply a play to a group of web servers in the playbook, and a different play to a group of database servers.
Ansible offers an enterprise-level features package, Ansible Tower, that is proprietary and not open source. With Ansible Tower, a user can create a workflow from multiple playbooks, integrate playbook run status alerts into third-party collaboration tools, and delegate playbooks with role-based access control, among other capabilities.
Let a virtualization expert take you through the construction of a playbook and how to set it in motion, all in under 10 minutes.