Ansible Playbook which will dynamically load the variable file named same as OS_name

 Here, we will create 2 files RedHat.yml and Ubuntu.yml 

Both will contain a variable called server and an ansible playbook will be created that will pick file accordingly the OS its been running and configure httpd if redhat and apache2 if it will be ubuntu.


Here, os.yml is the main file that will pick other files depending on which it is been running

This is the inventory file on which 137 is redhat and 135 is ubuntu

Lets have a look at our playbook


Files having server as a variable

After running this file for ubuntu 
For Redhat


Thank You for reading.

I would like to thanks Vimal Daga Sir.

My Email — ayanchawlae@gmail.com

Comments

Popular posts from this blog

Key Announcements at Microsoft Ignite

Ansible Handlers

Ansible Roles (Httpd + Haproxy)