ARTH TASK 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

To solve this problem, we can use Handlers

Handlers in ansible to be triggered only when there are some changes occur in particular file (any file, can be configuration file also) and then handler will do the task accordingly

Sometimes you want a task to run only when a change is made on a machine. For example, you may want to restart a service if a task updates the configuration of that service, but not if the configuration is unchanged. Ansible uses handlers to address this use case. Handlers are tasks that only run when notified. Each handler should have a globally unique name.

If you run the playbook again then it will shows that Your service is started so no need the restart again this become possible because of the handlers and notify keyword in ansible.

Creating a playbook to configure yum and intalling httpd package, wrting the webpage and to start httpd services

Runing the Playbook:

Giving the document root name as /var/www/main and port no as 84

Again running the same playbook with same document root name and port no; as there is no changes in configuration file of httpd so no need to restart the services (handler will do this for us)

Thank you for reading!

--

--

--

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

Take the lead on technology decisions – sustainable and efficient infrastructures with „Micro…

Create the Ultimate Campaign Management System

How To Create a Follow Feature in Rails by Aliasing Associations

Using Firestore database to access your Cloud Storage metadata

Collection: Python — Zach Quinn

Reasonable Spawning Rule- Game Dev Series 45

Kafka — An Event Streaming Platform

What Skills Does a Data Engineer Need?

Fisherman

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
Adithya Gangadhar Shetty

Adithya Gangadhar Shetty

More from Medium

Publish a book in a day?

Lineup Ninja — February 2022 Release Notes

CanMNT Early Preview — First WCQ Window of 2022

.p12 files are used to publish apps on the Apple App Store