Suppose that you are managing the Ansible Controller Node and setting up web-servers (apache webserver). You already have some Managed Nodes running that server and overnight your site gets hyped and you get great incoming traffic, which your server nodes are not able to handle, So you are advised to set up the same server in new managed nodes.
You run the following Ansible Playbook after adding the IPs of new nodes in your inventory file.
Result… the clients using older Servers will have to face a minor downtime, which is not acceptable.
So in order to avoid such a case, “Handlers” can come into play and can save your reputation. Just modify the Playbook like the following one. This playbook will only run restart the server if there is some change in your site’s design i.e in the copy module, otherwise, it won’t hamper the site on already running servers.
In this scenario only when there is any update in the copy module, only in that case the server will be restarted and not everytime you run your playbook.