In the snippet below, Am I right that elastic serach would be restarted 3 times assuming each action is performed?
Is there a way to collapse this into just one restart?
Say some way to set a flag for each action if the action is executed, and the at the end run a conditional to check if the flag >1 and then run the restart handler?
- name: elasticsearch | write java server wrapper from template, restart ES
action: template src=templates/elasticsearch_service_wrapper.j2 dest=${deploy_base}/elasticsearch-${elasticsearch.version}/bin/service/elasticsearch mode=0755
tags:
- configuration
notify:
- Restart elasticsearch
- name: elasticsearch | Install config from templates, then restart ES
action: template src=templates/$item dest=${deploy_base}/elasticsearch-${elasticsearch.version}/config/$item mode=0644 owner=root group=root
with_items:
- logging.yml
- elasticsearch.yml
tags:
- configuration
notify:
- Restart elasticsearch
- name: elasticsearch | Install upstart start script (conf) from templates, then restart ES
action: template src=templates/elasticsearch.conf.initd.j2 dest=/etc/init/elasticsearch.conf
notify:
- Restart elasticsearch
Thanks!
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/6853692e-ea81-4a9b-8fcb-cc49e247bbea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Handlers are lists of tasks, not really any different from regular tasks, that are referenced by name. Handlers are what notifiers notify. If nothing notifies a handler, it will not run. Regardless of how many things notify a handler, it will run only once, after all of the tasks complete in a particular play.
>>