Arth-Task 14.3

🔰 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.

(Note: No need to use when keyword here.)

Let’s Start……

1. Update the configuration file of Ansible :

path: vim /etc/ansible/ansible.cfg

2. Update the inventory files :

Above mentioned IP are the IP of the instances launched in AWS with different OS.

3. Create a Variable files :

a> RedHat.yml -> for Redhat operating system

b> Ubuntu.yml -> for Ubuntu operating system

4. Now let check the connectivity :

command : ansible all -m ping

5. Ansible playbook for automation :

In the above code i have used vars_files module to import the variable files according to the need.

6. Now run the playbook :

command : ansible-playbook file_name.yml

7. Check with the IP of RedHat OS :

command : IP:port_no./file_name.html

8. Check with the IP of UbuntuOS :

command : IP:port_no./file_name.html

Task Completed !!!

Thanks for reading… !



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store