From the course: Red Hat Certified Engineer (EX294) Cert Prep: 3 Managing Systems with Ansible

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing a playbook to manage software

Implementing a playbook to manage software

From the course: Red Hat Certified Engineer (EX294) Cert Prep: 3 Managing Systems with Ansible

Start my 1-month free trial

Implementing a playbook to manage software

- [Instructor] Let's talk about a different, more abstract solution to the problem of package names changing between distributions. We're going to use a variable for the package and service names. We're going to add a condition to our site.yml file that loads a variables file if the host is CentOS. Then we'll create the distribution specific variable files and place variables for the name of the packages and services in it. We'd have a file for each distribution here. Then we'll create tasks in our webserver role that will install packages based on the variable contents. For instance on CentOS we've installed the httpd package, and on Debian, we'd install the apache2 package. Lastly we'll create handlers that start Apache, add firewall rules, and then start the firewall. In a terminal in our rhhost1, change to the ansible-files and edit the site.yml file. Press z + R to expand the folds. Go into insert mode by pressing the i…

Contents