Making the restarting of HTTPD Service idempotence in Ansible
Idempotency using Handlers
In Ansible idempotency is provided to many of the modules but it is not available for the service module especially to restart the state
Idempotency is the method of checking if the requested change is already present then no change is made, if not present then the change will occur
In order to achieve idempotency for this, it can be done through handlers
Handler is a special keyword in ansible it is used to achieve a particular task only if another specified task is changed
The following is the playbook written to restart httpd service only if a file is copied
This playbook is run for the first time, in this the handler is tun because the copy has occured
This playbook is run for the second time, here the handler is not run because the copy has not happened



Comments
Post a Comment