The way the example code above is using notify
in Ansible isn't officially supported, so I'm not surprised it's not working (and would be surprised if it ever were really working). In your particular case, using one task in your playbook, or a handler that simply uses state=restarted
to restart the service, would be a better option:
- service: name=openfire state=restarted enabled=yes
However, if you do need to have multiple handlers run as a result of one operation, the best way to do it would be to notify each separate command in a chain. Note that this is almost always indicative of a deeper problem... but every once in a while, I've had to notify another handler after a certain handler completed, like so:
# Inside handlers/main.yml:
- name: import database
mysql_db: name=database state=import target=/path/to/dump.sql
notify: run shell script
- name: run shell script
shell: /path/to/some/shell/script.sh
This should be pretty rare, but I wouldn't think it's too bad an option for certain scenarios (in my case, I had to import a database dump, then run a shell script after that was complete, and the best way to make that operation idempotent was to notify the import database
handler instead of try doing the import directly in my playbook).