Task-14.3

Rishabh
2 min readMar 27, 2021

--

Task Description: 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.

Approach we are going to use will be:

1st we will create a var file (variable file) to store variable and for that we will be using the jinja templating.

STEP-1: Updating Inventory File.

STEP-2: Creating the var-file.

STEP-3: Writing a Playbook

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.

STEP-4: Executing Playbook

Tadaaa….Setup and Task is all completed with zero erros, Hope you guys learned and enjoyed.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Rishabh
Rishabh

Written by Rishabh

Student from B.tech 2nd Year, A proud ARTH learner, love new technologies, Curious about many thing, likes to explore places, love eating pizza and much more.

No responses yet