Ansible Playbook📃 which will Dynamically load Variable file named same as OS_Name
Hello Everyone!!🖐
In this Blog I am going to create a Ansible Playbook which will Dynamically load Variable file named same as OS_Name.
🔰For Create Same Playbook you need to follow the steps that are given below:-
STEP 1:-
Create a Folder of any Name in my case folder name is “webserver”
STEP 2:-
Create file of any name in webserver folder
STEP 3:-
Create ansible host file from any location:-
STEP 4:-
Configure your ansible configuration file that is /etc/ansible.cfg
💥NOTE:- Give Location of your Ansible host file :-
STEP 5:-
Content in /etc/ansible/hosts file
STEP 6:-
Content in file os.yml
STEP 7:-
Create two more in folder webserver
💥NOTE :- Both the name of file are same those i given above
STEP 8:-
Content of file RedHat.yml
STEP 9:-
Content in file Ubuntu.yml
STEP 10:-
Use Redhat and Ubuntu OS
This is my Redhat OS that is running in my local VM
This is my Ubuntu OS that is running on AWS Cloud
STEP 11:-
Run the ansible playbook(os.yml) by using command “ansible-playbook os.yml”
STEP 12:-
Use Ubuntu Instance Public IP in browser
This shows Webserver in Ubuntu OS is Ready!!✅
STEP 13:-
Use RedHat vm IP in browser
This shows Webserver in RedHat vm is Ready!!✅
If you liked the above blog, please share it.
DM me on LinkedIn in case of suggestions/feedback/queries:
❗LinkedIN Profile Link:-
ThankYou🙏