Create an Ansible Playbook which will dynamically load the variable file named same as OS_name and just by using the variable names we can Configure our target node.

I have 3 instances launched one is our control node, one RedHat OS and one Ubuntu OS

Inventory:

vim ip.txt

Ansible Configuration File:

vim ansible.cfg

We are going to use ansible facts to satisfy the requirements..

Main Task:

— Create a variable file named as RedHat.yml

— Create a variable file named as Ubuntu.yml

Create a playbook to configure webserver in our instances and will dynamically load the variable file named same as OS_name and just by using the variable names we can Configure our target node.

vim task14.3.yml

My /root/index.html file

Now run the playbook to configure our webserver…

Checking our website…

Task Completed successfully!!!

Thank You!!

--

--