In many situations, you will have a task or a group of tasks that change certain resources on the remote machines that need to trigger an event to become effective. For example, when you change a service configuration, you will need to restart or reload the service itself. In Ansible, you can trigger this event using the notify action.
Every handler task will run at the end of the playbook if notified. For example, you changed your HTTPd server configuration multiple times and you want to restart the HTTPd service so that the changes are applied. Now, restarting HTTPd every single time you make a configuration change is not a good practice; it is not a good practice to restart the server even if no changes have been made to its configurations. To deal with such a situation, you can notify Ansible to restart the HTTPd service on every configuration change...