Hi Team,
I am trying to remove and create the directory in single task but it is
failing. Could someone please help.
vars/main.yml
SAMPLE:
- { src: '/tmp/abc.war', dest: '/tmp/test/' }
- { src: '/tmp/def.war', dest: 'tmp/test/' }
- { src: '/tmp/xyz.war', dest: '/tmp/test/' }
Playbook.yml
---
- hosts: all
tasks:
- name: Ansible remove and create directory
file:
path: "{{ item.dest }}"
state: absent
with_items:
- { "SAMPLE", state: absent }
- { "SAMPLE", state: directory }
ERROR:
{"msg": "The task includes an option with an undefined variable. The error
was: 'dict object' has no attribute 'path'\n\nThe error appears to have
been in '/etc/ansible/test/tasks/main.yml': line 23, column 5, but may\nbe
elsewhere in the file depending on the exact syntax problem.\n\nThe
offending line appears to be:\n\n\n - name: ansible create directory
example\n ^ here\n"}
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/60202e37-9d08-4655-bd28-1aef955d4cd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.