Simple way of deleting a directory with ansible, is putting the state as absent
:
tasks:
- name: Delete directory
file:
path: /tmp/aDirectory
state: absent
Next time you run that task it will delete that directory and the files within.
Comments