title: Ansible: How to delete a folder and file inside a directory in a single task?
body: <p>I'm using Ansible 2.3.2.0 and am trying to delete a file and folder inside a directory in one task. </p>
  
  <p>Right now I have this</p>
  
  <pre><code>tasks:
  
    - name: Removing existing war
      file:
        path: /usr/share/tomcat/webapps/app.war
        state: absent
  
    - name: Removing existing folder
      file:
        path: /usr/share/tomcat/webapps/app
        state: absent
  </code></pre>
  
  <p>I cannot simply remove the webapps folder because I do not want to delete other files and folders in there. I want to reduce the number of tasks because I am using Duo push auth and this adds to the deploy time. I've tried looping over files and file globs but for some reason it never works. </p>
  
  <p><a href="http://docs.ansible.com/ansible/latest/playbooks_loops.html#looping-over-files" rel="noreferrer">http://docs.ansible.com/ansible/latest/playbooks_loops.html#looping-over-files</a></p>