Ansible, HTTPD Integration and the Idempotent Nature of Ansible
Abhishek Anand
Backend Developer @Jio Platform Limited | Software Engineer | Former Associate Software Engineer Intern @Nextuple | Indian Institute Of Information Technology Bhopal
Task Description
?? 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.
Why and when we need to restart a service?
Restarting a service is needed when there is change in the configuration file of the server. After restarting only that the new change done in the configuration is reflected.
Why is meant by the idempotence nature of Ansible?
Idempotence nature means that the when we run a playbook the tasks or services which is not present on the managed node only that part is performed and the part which is already done is ignored.
for example: If we want to install httpd software the we write a playbook and that will do the same. The intelligence of ansible will first check for the application. It will install httpd only when it is not present.
Lets talk about the restart option of service module-
Restart option of Service Module is not idempotence in nature. Which means it will keep on performing the task even if there is no any change.
To handle this we have to option of ansible playbook which when used together will make the restart option of service module idempotence.
Lets see the video for the code and more details:
Thank you!
Former SDE Intern @Raja Software Labs, Pune
4 年Very useful , Great work !!!