1.

What is a handler in Ansible?

Answer»
  •  Handlers are just like regular tasks in a playbook, but they will only be run if a TASK notifies the handler. If a task that would’ve notified the handlers is skipped DUE to a when condition or something of the like, the handler will not be run. 
  •  Handlers are automatically loaded from roles/<role_name>/handlers/main.yaml. These handlers can be referenced by any task within the role, or by any tasks within any other role that LISTS this role as a dependency. 
  •  Handlers will run once, and only once, after all of the tasks complete in a particular play. 
  •  If the play FAILS on a particular host (or all hosts) before handlers are notified, the handlers will never be run(but we can use the command LINE flag --force-handlers when running the playbook to run the handler always) 


Discussion

No Comment Found