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 5 lab solution: Using a playbook to deploy a webserver

Lesson 5 lab solution: Using a playbook to deploy a webserver - Ansible Tutorial

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

Lesson 5 lab solution: Using a playbook to deploy a webserver

All right, let's call this playbook lab5.yaml. And we do need to do a couple of things. So let's start with the name, run a web server. We don't need facts. So gather facts is set to no. By the way, we were talking about it earlier, fact gathering cannot be set in the Ansible default.cfg as a standard value. So if you want to disable it, you need to do that in every single playbook. So here we go, getEffects. No. The hosts. Well, in my case, it will be Ansible 1. And then we have the tasks. So what am I going to do in the tasks? Well, I'm going to start by using debug. Now, that's not nice. We should use a name. So name installing httpd and debug message installing httpd. Now that's a little bit redundant, but I do that for a reason. The reason is that the name for the task, I need it to be there. It's good practice to have a name for all the single tasks that you are running so that you can easier troubleshoot. And debug requires an argument and the argument, well, that's a message…

Contents