delegate_to and notify handler to run once

Hello,

I use ansible to configure several servers and use “delegate_to” to write out their nagios configs on the nagios server. If the config is changed a notify handler is fired like below:

That may be a bug, as handlers are only supposed to trigger once of course despite the number of notifications sent to it. Could you open an issue on github for this?

Thanks!

​Are you repeating this task among several plays? Handlers will fire once
per play, not per playbook.
​

It’s called once in one play in the “common” role i.e. once for each server that matches the “–limit” option when I run ansible-playbook.

e.g.

“ansible-playbook -i production site.yml -l myserver.example.com -sK” will restart nagios once.

“ansible-playbook -i production site.yml -l webservers -sK” will restart nagios once for each server in the webserver group.

Tom

​Oh, I see, it's still called once for every host in that play.
That's how it currently works I'm afraid.​

Slight correction –

Handlers run for each host that notified them, not for every host.

There has been some interest in a “global notify” but you may want to just do a “trailing play” that restarts the remote nagios config every time.