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

1
2
3
4
- name: Delete content & entire directory
  file:
    state: absent
    path: /some/directory/path/