Hi,
(This is a followup to https://github.com/ansible/ansible/issues/5634)
Is there a way to “stack” delegated handlers?
When the handler is delegated to some host and several hosts kick that handler it is triggered several times instead of once.
It is perfectly valid when the handler in its rendered form is different a bit for each remote host (say you are sending some event notifying that
the server has got up) but if the handler in its rendered form is completely the same it should be triggered only once.
Consider the generic example:
- hosts: all
- tasks:
- name: do some configuration stuff
…
notify: - restart server
- handlers:
- name: restart server
service: name=myservice state=restarted
delegate_to: “{{ server_ip }}”
The natural way would be to have the central server (the one to which we delegate the action) restarted only once instead of restarting it for every processed host.
Of course if we run several servers (i.e. use several server_ip’s here) the action should be triggered for each of them.
That’s why I’m talking about “rendered form” of action (i.e. after all variable substitutions are done).
Or is there a parameter to handler that would make it behave like that? I have not found any in http://docs.ansible.com/playbooks_intro.html
Thanks,
Timur