Create an Ansible Playbook which will dynamically help us to configure OS of different distributions.

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.( Note: No need to use when keyword here. )

So for doing so first we would launch two OS on AWS cloud such that one is RedHat and the other is ubuntu. So that we could configure them for running web server separately.

Now we would update our inventory file with the IP addresses of the OS launched on the AWS server.

Now we would create two different variable files in the YML format and keep the file name the same as the OS i.e. RedHat and Ubuntu so that they would have the package name used in them for deploying web server over the Internet.

Now we would import the variable file in the YML file by writing {{ ansible distribution }} which would eventually be replaced by the exact same name of the Linux OS. And it would then replace the package name as httpd in the case of RedHat and apache2 in the case of Ubuntu.

Now we would run our playbook and check if any error comes up.

We could clearly see that there are no errors and our code was successful.

Now we can open our in our chrome browser and see that our web page is displayed according to the Linux OS.

Thank you, everyone.
Feel free to contact me in case of any doubts @ https://www.linkedin.com/in/shivansh-srivastava-77a3a31a5/

--

--

--

I automate things 😉

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Emojis as Python Variables? Sure, Why Not!

Microservices for Startups: An Interview with Christian Beegden and Stefan Zier of Sumo Logic

READ/DOWNLOAD*] Microsoft Hybrid Cloud Unleashed w

How Gradle Build Works in Android

Are WordPress developers in demand?

Java interview question

Tackling Asynchrony with Kotlin Coroutines

Good communication is key to successful team

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
Shivansh Srivastava

Shivansh Srivastava

I automate things 😉

More from Medium

How Big Of An Issue Is Game Cyber Security?

How to add Google Ads Conversion Tracking GCLID to Contact Form 7

How to Add Sections on PowerPoint

Coffee Now Sold at Student Store