Here is my variable file:
cat vars.yml
`
Here is my variable file:
cat vars.yml
`
Hi
you've missed a few basic things. The vars file contains a duplicate
variable layers - that won't work.
Also, you appear to want to loop over the variable layers, but you
don't actually use it.
Have a look at this URL, it has some nice examples of how loops work:
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#iterating-over-a-simple-list
Dick Hi, The issue is not with the loop as I can see the correct value populated using debug.
Aslo, the correct value shows up in the error output from the loop … see below:
fatal: [localhost]: FAILED! => {"changed": false, "msg": "file (/tmp/dashboard/APP state=directory recurse=yes) is absent, cannot continue", "path": "/tmp/dashboard/APP state=directory recurse=yes"}
/tmp/dashboard/APP is indeed the correct desired directory that should be created.
Please suggest.
Hi shifa,
Can you please check whether dashboard dir is present on remote server?
Thanks,
Vivek
Ah OK yes, i see, you're right.
The issue is your quoting, as indicated by the error message.
Instead of:
- file: path="{{ playbook_dir }}/dashboard/{{ my_result.name }}
state=directory recurse=yes"
Do this:
- file: path="{{ playbook_dir }}/dashboard/{{ my_result.name }}"
state=directory recurse=yes
@Dick your suggestion helped !! it works.