From the course: Red Hat Certified Engineer (EX294) Cert Prep: 2 Using Ansible Playbooks

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Using includes in Playbooks

Using includes in Playbooks

From the course: Red Hat Certified Engineer (EX294) Cert Prep: 2 Using Ansible Playbooks

Start my 1-month free trial

Using includes in Playbooks

- [Instructor] Now let's use includes in playbooks. In our choice one be sure that you're in your ansible files directory. Now change into your web service task directory. Type cd space roles slash web servers, slash tasks and hit Enter. Let's create a file here called main.yml. Type in vim space main.yml and hit Enter. Go into insert mode by pressing the I key and add dash dash dash because this is a YAML file new line dash space include colon space install underscore apache.yml. We're going to dynamically call a YAML file called install underscore apache.yml. Notice that we didn't have to include a path. Ansible will know to look for it within the test directory. Now save an exit by pressing Escape colon x exclamation mark and hitting Enter. Using this method we could later include other plays that would install other web server based software. Remember this is the web server role so you want to restrict what you do here…

Contents