LOGBOOK

HELP

Quiz Entry - updated: 2026.11.12

Can one task notify more than one handler?

Yes. notify is a list; Ansible goes through it and queues every handler named there.

tasks:
  - name: copy demo.example.conf configuration template
    ansible.builtin.template:
      src: /var/lib/templates/demo.example.conf.template
      dest: /etc/httpd/conf.d/demo.example.conf
    notify:
      - restart mysql
      - restart apache

handlers:
  - name: restart mysql
    ansible.builtin.service:
      name: mariadb
      state: restarted

  - name: restart apache
    ansible.builtin.service:
      name: httpd
      state: restarted

If the template task reports changed, both handlers are queued. Note that the handler named restart mysql restarts the mariadb service: the handler's name is just a label for humans and for notify, and has no link to the service it manages.

A single handler can be notified as a plain string (notify: restart apache); the list form is what allows several.

Go deeper:

From Quiz: ITIA / Ansible Task Control: Loops, Conditionals, Handlers and Error Handling | Updated: Nov 12, 2026