handler (Ansible)
A task that runs only when another task notified it, and a task notifies only when it reported changed. The typical handler reloads or restarts a service after its configuration file changed. It runs once, at the end of the play, however many tasks notified it, in the order handlers are listed rather than the order of notification. The misconception it exists to correct is the restart written as an ordinary task at the end of the playbook: state: restarted is an action, so that task changes on every run, restarts the service for nothing and destroys the changed=0 reading. The failure worth knowing: if a later task fails, notified handlers do not run, so the configuration changed and the service was not reloaded — --force-handlers runs them anyway. The lab in the Ansible course is a restart placed as a task before the template that changed.
Also written: notify, handlers
