Create a Playbook
Make Ansible tasks repeatable using playbooks.
We'll cover the following...
Playbooks are the basis of configuration management, and orchestrated automation with Ansible
, and are designed for automating repeatable tasks.
Playbooks are expressed in YAML and have a minimum amount of syntax. YAML is a model of a configuration or a process. Because playbooks define a process and/or configuration, they are kept in source control.
Each playbook is composed of one or more plays. A play starts by defining the hosts
line. The hosts
line is a list of one or more groups or host patterns separated by colons.
Press + to interact
---- hosts: localhost
Optionally, you can define the user to run the play as.
Press + to interact
---- hosts: localhostremote_user: root
The hosts
line is followed by a tasks
list. Ansible
executes tasks in order, one at a time, against ...