From 070080dd8697c5ce7fccacaa34b78b12087fee92 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 12 Apr 2019 17:27:53 +0200 Subject: [PATCH] Support file removal Signed-off-by: Knut Ahlers --- tasks/inner.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tasks/inner.yml b/tasks/inner.yml index 9826867..2e3947b 100644 --- a/tasks/inner.yml +++ b/tasks/inner.yml @@ -34,6 +34,13 @@ unsafe_writes: '{{ item.unsafe_writes | default(omit) }}' validate: '{{ item.validate | default(omit) }}' register: simplefile_write_file + when: item.state is not defined or item.state != 'absent' + +- name: Remove file + file: + dest: '{{ item.dest }}' + state: 'absent' + when: item.state is defined and item.state == 'absent' - name: Execute post-command command: '{{ item.post_command }}'