What is an Ansible playbook?
An Ansible playbook is an organized unit of scripts that defines the tasks involved in managing a system configuration using the automation tool Ansible.
Ansible is a configuration management tool from Red Hat that automates the process of configuring multiple servers and deploying applications. A playbook is the core component of any Ansible configuration.
Components of an Ansible playbook
Ansible playbooks are composed of one or more plays, which are in turn composed of modules.
Plays are written in YAML and define the work associated with a configuration on a managed server. There are no standard plays; instead, administrators create plays with environment-specific parameters for the target machines.
Ansible plays are flexible due to modules -- scripts written in Python or PowerShell that pertain to various aspects of the target managed servers. Modules exist for many parts of system configurations, including software installation and user management. Ansible provides many modules, as does the open source community that uses and supports Ansible.
Working with Ansible playbooks
A playbook 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 managed by Ansible, with the option to group hosts by functionality. For example, an administrator could apply one play to a group of web servers and another play to a group of database servers.
Ansible offers a proprietary enterprise version, Red Hat Ansible Automation Platform, in standard and premium tiers. Ansible Automation Platform users can create workflows from multiple playbooks, integrate playbook run status alerts into third-party collaboration tools and delegate playbooks using role-based access control, among other capabilities.