Ansible playbook

This definition is part of our Essential Guide: Learn DevOps techniques in a home lab

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 playbook text in YAML.
This example Ansible playbook sets up a controller. It is written in YAML.

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.

This was last updated in August 2017

Continue Reading About Ansible playbook



Find more PRO+ content and other member only offers, here.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

Is YAML currently, or soon to be, part of your IT operations skill set?


File Extensions and File Formats

Powered by: