Where do handlers go in a role, and how do tasks notify them?
BeginnerConceptRoles, Collections and Galaxy
Answer
Handlers live in handlers/main.yml inside the role. Tasks in the same role notify them by name. Role handlers are visible to the entire play, so a task in another role (or playbook) can notify them as well, which is why handler names should be unique, usually prefixed with the role name.
# roles/nginx/handlers/main.yml
- name: nginx | reload
ansible.builtin.service: { name: nginx, state: reloaded }