delete file on deb install

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

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