HTTPD Server starting Idempotence
Idempotence :-A request method is considered “idempotent” if the intended effect on the server of multiple identical requests with that method is the same as the effect for a single such request. Of the request methods defined by this specification, PUT , DELETE , and safe request methods are idempotent.
While restarting Httpd server using Ansible , it is not Idempotent as It always downloads all the resources whether they are changed or not , consumes so much or memory and space , while the work can be done in very few.
so What Idempotence refers here , it refers that is anything is changed in our service only that part would be affected while running ansible playbook , rest of the things will remain same.
In Ansible , to execute this Idempotence property there are some handlers and keywords which help us in deploying the idempotence httpd server with playbook.
Handler:- Handlers are tasks that only run when notified.
Objective :- Restarting HTTPD Service is not idempotence in nature and also consume more resources suggest a way to rectify this challenge in Ansible playbook”.
for this , we will have 2 RHEL-8 VMs . one of them will be with Ansible installed . In this ansible VM we will write ansible-playbook and by using its inventory file we will be launching a httpd server in other os .
Ip of the os I’m using as worker node is 192.168.0.109
Lets start by providing Inventory file and configuration file to Ansible VM
Inventory file for Ansible :- ip.txt
Configuration file for ansible
To update some details into our worker node , we need to write a conf file and send it to worker node via ansible-playbook. so conf file is :-aman. Conf
Now we need to write the Ansible-playbook for the task . so the playbook is on github , check it out
Now what we need to do is just run the playbook and everything set up
so just run the playbook
It is Working Properly .
Now go to worker node and check the status of httpd server whether it is running or not
now use the worker node ip:port to access the webpage we created .
And our Idempotence Launch of httpd server is done.
That’s all with this article. I hope you found the post Informative, if something was missing or you think some more things could have been added, feel free to provide suggestions in the comments section or on LinkedIn.
You can check out my LinkedIn profile.
Aman Goyal - Student Intern and Technical volunteer - LinuxWorld Informatics Pvt Ltd | LinkedIn
View Aman Goyal's profile on LinkedIn, the world's largest professional community. Aman has 6 jobs listed on their…