From the course: Ansible Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Using role-based templates

Using role-based templates - Ansible Tutorial

From the course: Ansible Essential Training

Using role-based templates

- [Instructor] It probably won't surprise you to learn that roles make template use simple. After all, a major aspect of roles is they seek to bring order to our many components we can use with our Ansible playbooks. So let's go over to our roles directory, and we're going to go to, of course, etc Ansible roles, the default location, and let's take a look at our test role. So we're going to change into that test role directory. Now, if we look at the tasks, you'll notice that I have edited our main.yaml and I have tied in the index.html creation task as well as the starting of the Apache 2 service and this is our Jinja template and it's the Jinja template that we had used before. Now, remember, before when we did this, we needed the playbook in the same directory with that source, Jinja template. But now what we have done, let's go up one level, and let's now go into the templates directory. Sure enough, we have moved…

Contents