Rishabh
2 min readMar 22, 2021

đź”° 11.3 Restarting HTTPD Service is not idempotence in nature and also consume more resources suggest a way to rectify this challenge in Ansible playbook!!

>>We will be using HANDLERS to solve our problem, As handlers run when they are notified.
>>So we will be launching a Httpd webserver and we only want to restart our service only when ever there are some changes in the configuration file
>>As soon as the config file is modified , the notifier will contact the handler to do the asked.

Prerequisite:

  1. Master Node/Controller node which is fully configured to write the playbook
  2. Slave Node/ Managed Node to run the playbook

So let’s get started ….

STEP-1:So let’s create playbook in controller node which can configure apache httpd webserver on target nodes with the help of handlers.

STEP-2:Running the playbook

Everything was successfully, But as we all can see here the Handlers ran as it is 1st time we changed the Config file, Now lets try to run the playbook again without changing the in the config file>We hope to see as changed=0

STEP-3: Re-running the playbook without any change in config file

So Finally task Completed. Hope you guys enjoyed and learned something.

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

Write a response