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 7 lab solution: Making playbooks flexible with variables

Lesson 7 lab solution: Making playbooks flexible with variables - Ansible Tutorial

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

Lesson 7 lab solution: Making playbooks flexible with variables

So let me create lab6.yml and in lab6.yml, what do we need to do? Well, we need a name, installing webpackage, host is going to be, no not all, because we need one play for Red Hat and one play for Ubuntu. hosts red hat so hosts red hat and then we get tasks and the tasks are what do we need to do well we need to install it so name installing web package yum name WebPackets.stateLatest. We want to update as well. And then we are going to use service to actually start it. So name, startingWebPackets.service.nameWebPackets.started Wasn't there something with permanent as well in service? Let's do an Ansible doc on service to figure it out. Going to the example, state started and yeah, we need an enabled. Oh, enabled, that's what we needed. So enabled is going to be set to yes. Nobody is saying anything about firewalls in this lab exercise, so I'm not going for the firewall. If you are doing this course because you prepare for an exam like RHCE, this is also very important on the exam…

Contents