From the course: Complete Guide to Configuration Management Using Ansible

Unlock this course with a free trial

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

Lesson 6 lab: Making playbooks flexible with variables

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

From the course: Complete Guide to Configuration Management Using Ansible

Lesson 6 lab: Making playbooks flexible with variables

All right. 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 Apache2, 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 hosts and another play for the Ubuntu hosts. Good luck.

Contents