Restarting HTTPD is not Idempotence in Nature

Ansible is simple open source IT engine which automates application deployment, intra service orchestration, cloud provisioning and many other IT tools. Ansible is easy to deploy because it does not use any agents or custom security infrastructure.

So firstly we should talk about Idempotent Nature….

Idempotence means after 1 run of a playbook to set things to a desired state, further runs of the same playbook should result in 0 changes.

Why we need to Restart HTTPD services again..?

Its because when we make some changes in Configuration file of Managed node through Ansible playbook , just after that we need to Restart httpd services .


To solve this issue of restarting services through playbook only we can make the use of Handlers in our playbook .

Handlers are just like normal tasks in an Ansible playbook but they run only when if the Task contains a “notify” directive. It also indicates that it changed something.

Lets start…

Now after that we have to update this inventory file in the Configuration file of ansible so that ansible will come to know that which nodes it has to configure.

After all these above steps we finally have to write the playbook to configure what we want.

Here in this playbook I have used ansible.posix.selinux collection so that I can disable the SElinux security in Managed Node .

So to use this collection , it must be installed on your Controller Node

And this is the Change.conf file which I used in playbook. In this file we have mentioned the Document root and the port Number that we need to change.

We can see playbook ran successfully.

We can see that configuration is successfull.

We can see our site successfully.

Thank you !!



Upcoming Engineer

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