Hello,
I’m performing the following tasks :
- name: download ElasticSearch package
get_url: url=http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-{{elasticsearch_version}}.deb dest=/home/ubuntu/elasticsearch-{{elasticsearch_version}}.deb
- name: Install ElasticSearch .deb file
command: dpkg -Ei /home/ubuntu/elasticsearch-{{elasticsearch_version}}.deb
- name: Updating ElasticSearch config
copy: src=elasticsearch.conf.yml dest=/etc/elasticsearch/elasticsearch.yml
notify: restart elasticsearch
- name: Updating ElasticSearch defaults
copy: src=elasticsearch.default.conf.yml dest=/etc/default/elasticsearch
notify: restart elasticsearch
And obviously the second task is always run. So at the end of my playbook I have always at least 1 “changed”.
I don’t find it very satisfying… So I am looking for a way to prevent this.
I considered using a where clause where I would check the elastic search version (dpkg -s elasticsearch | grep ‘Version’) but I would somehow need a shell task and a register for that and it would still appear as “changed”.
I considered also using notify on the download but what about the other tasks that need the install ? They cannot be defined as handlers of the install because I want to be able to change the config (execute task 3 and 4) even if there is no new version of the package.
Am I right about this ? Is there another way ? Is it foolish to hope for 0 “changed” on consecutive runs ? Or is it really something I should chase ?
I hope I made myself clear !
Thanks a lot for your amazing work.