How to Delete Files and Folders in a Directory Using Ansible


If you need to delete files and folders in a directory using Ansible, then you can do the following:

- name: Delete content & entire directory
  file:
    state: absent
    path: /some/directory/path/