# delete file on deb install

**URL:** <https://forum.ansible.com/t/delete-file-on-deb-install/16052>\
**Category:** Ansible Project\
**Created:** [August 27, 2014, 4:08pm UTC](https://forum.ansible.com/t/delete-file-on-deb-install/16052 "2014-08-27T16:08:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Olliver](https://avatars.discourse-cdn.com/v4/letter/m/8491ac/32.png) [@Mark\_Olliver](https://forum.ansible.com/u/Mark_Olliver)\
**Post date:** [August 27, 2014, 4:08pm UTC](https://forum.ansible.com/t/delete-file-on-deb-install/16052/1 "2014-08-27T16:08:30Z")

</div>

Hi,

We use a custom config file for redis sentinel, Is there a way with to say that when i have installed the redis package, to remove the file /etc/redis/sentinel.conf. But it should only remove it the once. Later in the run i check if the file is missing and if it is then I add the correct file, the file however is not updated on subsequent runs as it is managed by redis directly.

Thanks

Mark

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 27, 2014, 7:05pm UTC](https://forum.ansible.com/t/delete-file-on-deb-install/16052/2 "2014-08-27T19:05:48Z")

</div>

Yes:

tasks:

- apt: name=redis state=installed  
notify:
- remove sentinel

# if you wish to remove it immediately don’t do this, and see below

handlers:

- name: remove sentinel  
file: path=foo state=absent

If you wish to remove it immediately, instead:

tasks:

- apt: name=redis state=installed  
register: redis
- file: path=foo state=absent  
when: redis.changed

etc
