Introduction to Ansible Transcripts
Chapter: Ansible Core Concepts
Lecture: Playbooks
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Playbooks are the highest level concept in Ansible and playbook is likely the most frequent term that you will hear used when people
0:08
are talking about Ansible. Playbooks are the top level collection and every playbook contains one or more roles typically many tasks within those roles
0:14
associated variables and all the other information necessary for execution such as which servers are we going to execute this playbook against.
0:23
Playbooks are run by using the ansible-playbook command. Just as we had roles to group related tasks together to accomplish various actions
0:31
we also needed a way to organize and group the tasks, roles and variables. And that is what a playbook is. A simplified example of a playbook
0:39
would look like this, with the following file names and directory structures. As we saw in the roles video in this case we have two roles
0:46
common and webserver. We also have a couple of new files. The first one, deployment.yaml is the playbook instruction file
0:52
we'll reference when we use the Ansible playbook command. Deployment.yaml would contain references
0:58
to the groups of servers that we'll run our roles on. So deployment.yaml contains the bridge between our roles and the servers that we want
1:06
Ansible to manage or handle a deployment on. There's also a hosts file. The hosts file contains the list of servers
1:11
that we want to execute our playbook against. Hosts is also known as the inventory file which we'll discuss next.