# Prevent fake "changed"

**URL:** <https://forum.ansible.com/t/prevent-fake-changed/13073>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [July 5, 2013, 2:57pm UTC](https://forum.ansible.com/t/prevent-fake-changed/13073 "2013-07-05T14:57:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrien\_Montfort](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@Adrien\_Montfort](https://forum.ansible.com/u/Adrien_Montfort)\
**Post date:** [July 5, 2013, 2:57pm UTC](https://forum.ansible.com/t/prevent-fake-changed/13073/1 "2013-07-05T14:57:24Z")

</div>

Hello,

I’m performing the following tasks :

> 

> - name: download ElasticSearch package  
> get\_url: url=[http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-{{elasticsearch\_version}](http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-%7B%7Belasticsearch_version%7D)}.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.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [July 5, 2013, 3:02pm UTC](https://forum.ansible.com/t/prevent-fake-changed/13073/2 "2013-07-05T15:02:31Z")

</div>

There’s an open pull request for an “ignore\_changed: True” option on the task in Ansible 1.3

Though you may also wish to use the ‘creates=’ parameter to control the change state

Of course since you are invoking dpkg, I’d think you could also just use the apt module from a repository if it were available, which it might not be.

---

<div class="post-metadata">

**Author:** ![Adrien\_Montfort](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@Adrien\_Montfort](https://forum.ansible.com/u/Adrien_Montfort)\
**Post date:** [July 5, 2013, 4:29pm UTC](https://forum.ansible.com/t/prevent-fake-changed/13073/3 "2013-07-05T16:29:37Z")

</div>

Thanks,  
I can indeed use the creates parameter (in my case creates=/usr/share/elasticsearch/lib/elasticsearch-{{elasticsearch\_version}}.jar).  
I think it’s exactly what I needed !
