Delete multiple directories with ansible

ansible-playbook

Hellos. I need to delete a few directories on a group of machines. I can't seem to get the file module to do my bidding. The below module will run without error and does not delete anything. I do not want to remove /opt.

- hosts: [dummies]   tasks:
    - name: destroy these paths!
      file: path=/opt{{ item }} state=absent recurse=no
      with_items:
        - "foo"
        - "bar"
        - "baz"

Best Answer

I don't think Ansible is going to add a slash for you.

file: path=/opt/{{ item }}