Introduction to Ansible Transcripts
Chapter: Running Playbooks
Lecture: Writing Our First Playbook
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Time to match those Ansible concepts with a specific example, and we're going to write our first playbook together.
0:06
This playbook will contain several directories and files and here's the structure we're going to create.
0:10
I'll have a project directory named first playbook. We're going to have an inventory file named host that'll contain the list of IP addresses.
0:16
In our case, only a single IP address for server that we want to work with. We'll have out top level playbook.yml file
0:22
that will tell Ansible what users should be executing which tasks mapped to the servers. It's specified in the host file.
0:28
We'll have a directory and a few subdirectories roles/common/tasks that will contain YAML files with the tasks that we want to run
0:35
against the server specified in the inventory file. main.yml is the entry point for a role so we'll include other files in main.yml
0:42
like ping.yml and other files that we'll create along the way with tasks in them. So, we'll build up main.yml
0:48
by including other YAML files as we go along. That's the overall structure of the directories
0:53
and the files we're going to be creating in the next few videos and the purpose of these should become apparent
0:57
as we start writing our files and then running them against our server.