handler
A task that runs only when another task notifies it and reports changed, typically to reload or restart a service.
In more detail
Handlers are declared under the handlers key of a play or in a role's handlers/main.yml and run after the play's ordinary tasks. However many tasks notify a handler, it runs once. If every notifying task reports ok, the handler does not run at all.
Related terms
- notify — The task keyword that names one or more handlers to run later if this task reports changed.
- changed — The task result meaning the module ran and altered the host to make it match the description.
- service module — The module that starts, stops, restarts or reloads a background service on a host and sets whether it starts at boot.
- template module — The module that fills in a Jinja template with variables and writes the result to a file on each host.
Taught in
- Handlers And Notify — Ansible Configuration Management at Scale
- Templates With Jinja — Ansible Configuration Management at Scale
- The Standard Directory Layout And Roles — Ansible Configuration Management at Scale
- Writing A Role — Ansible Configuration Management at Scale
- Deploying Files: file, copy, lineinfile And blockinfile — RHCE in Ansible (EX294): Automate Red Hat Systems
- Conditionals: register, when, changed_when And failed_when — RHCE in Ansible (EX294): Automate Red Hat Systems
- Handlers And Failure: notify, block, rescue And always — RHCE in Ansible (EX294): Automate Red Hat Systems
- Roles: The Directory Ansible Expects, Defaults And Handlers — RHCE in Ansible (EX294): Automate Red Hat Systems
- RHEL System Roles: timesync And selinux From A Collection — RHCE in Ansible (EX294): Automate Red Hat Systems
- Services And Boot Targets: Started Is Not Enabled — RHCE in Ansible (EX294): Automate Red Hat Systems
- Mock Exam, Part 1: Seven Tasks Across Three Sections — RHCE in Ansible (EX294): Automate Red Hat Systems