xxxxxxxxxx
In Ansible, a handler is similar to a regular task in a playbook,
but it will only run if a task alerts the handler.
Handlers are automatically loaded by roles/<role_name>/handlers/main.yaml.
Handlers will run once, after all of the tasks are completed in a particular play.
xxxxxxxxxx
Handlers are like special tasks which only run
if the Task contains a “notify” directive.
1tasks:
2 - name: install nginx
3 apt: pkg=nginx state=installed update_cache=true
4 notify:
5 - start nginx
6 handlers:
7 - name: start nginx
8 service: name=nginx state=started
In the above example
after installing NGINX we are starting the server using a `start nginx` handler.