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

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

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

Lesson 7 lab: Making playbooks flexible with variables

Alright, we are now at the end of this lesson, let's do a lab. So in this lab, you use host variables to define a variable web package and a variable web service, which is set to the appropriate packages for Ubuntu and Red Hat, where Ubuntu is using Apache 2 and Red Hat is using Httpd. Next you write a playbook that installs the packages on each distribution based on these variables. As we have not yet talked about conditionals, I advise you not to use conditionals, but write one play for the Red Hat family host and another play for the Ubuntu hosts. Good luck!

Contents