From the course: Ansible: From Basics to Guru by Pearson

Unlock this course with a free trial

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

Lesson 10 lab solution: Working with roles

Lesson 10 lab solution: Working with roles - Ansible Tutorial

From the course: Ansible: From Basics to Guru by Pearson

Lesson 10 lab solution: Working with roles

Alright, so let's create lab9.yml and in lab9.yml we are going to install nginx on hosts redhat Then we need pre-tasks and in the pre-tasks we are going to do what? Well, we are going to remove apache. So yum colon name httpd state absent. That's a typo, that should be httpd. Good, then we need to update all packages. I'm going to do a placeholder here, updating all packages. For the simple reason that I don't know yet how to update all packages, but I want it to be in the structure now that I'm focusing on the generic structure of my playbook. Now we have roles, and we already have Gearling, Guy, Dalt, Nginx, and that's what I'm intending to use. Next, we have post tasks and in the post tasks, well, again, I'm using a debug with a message removing yum package cache. It looks as if we need to investigate the yum module a little bit more. So first updating packages and then the package cache. So Ansible doc on YUM. And in case you are wondering, why are you using YUM? Well, I am using…

Contents