Hi shifa, Can you please check whether dashboard dir is present on remote server?
Thanks, Vivek On Mon, Mar 16, 2020, 1:11 PM Shifa Shaikh <[email protected]> wrote: > 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. > > > On Monday, March 16, 2020 at 1:00:24 PM UTC+5:30, Dick Visser wrote: >> >> 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 >> >> >> >> On Mon, 16 Mar 2020 at 08:21, Shifa Shaikh <[email protected]> wrote: >> > >> > Here is my variable file: >> > >> > cat vars.yml >> > --- >> > >> > layers: >> > - name: APP >> > layers: >> > - name: WLS >> > >> > >> > Here is my playbook >> > >> > cat varloop.yml >> > --- >> > >> > hosts: localhost >> > vars_files: >> > - vars.yml >> > >> > >> > >> > tasks: >> > - name: Create sublinks based of bad.txt files >> > include_tasks: "{{ playbook_dir }}/inner.yml" >> > loop: "{{ layers }}" >> > loop_control: >> > loop_var: my_result >> > >> > inner.yml >> > - name: Generate JSON data >> > block: >> > - file: path="{{ playbook_dir }}/dashboard/{{ my_result.name }} >> state=directory recurse=yes" >> > >> > >> > However, I'm getting the following error running the code: >> > >> > TASK [file] >> ************************************************************************************************************************************************* >> >> > 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"} >> > >> > I was expecting the play to create the directory "/tmp/dashboard/APP", >> however it errors and fails. Can you please suggest ? >> > >> > -- >> > 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 view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/0fe8246b-1d71-44c4-baa0-6185815366a1%40googlegroups.com. >> >> >> >> >> -- >> Dick Visser >> Trust & Identity Service Operations Manager >> GÉANT >> > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/42e9abb0-78c1-4f0e-940a-a185f1a34ba6%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/42e9abb0-78c1-4f0e-940a-a185f1a34ba6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAA420E96TurmPm-gkPj_Z417wD1HBMOZqmCg1nboatYL_ttPaQ%40mail.gmail.com.
