with_first_found issue

16 views
Skip to first unread message

Adrian Paraschiv

unread,
Mar 4, 2016, 9:28:22 AM3/4/16
to Ansible Project
Hello all,

I have this part of a playbbok


- shell: echo "{{ ansible_env.CMS_PLI }}/conf/application.conf"
  register: pli_loc
- shell: echo "{{ ansible_env.CMS }}/conf/application.conf"
  register: cms_loc
- shell: "echo {{ item }}"
  with_first_found:
    - "{{ pli_loc.stdout }}"
    - "{{ cms_loc.stdout }}"
    - "{{ ansible_env.CMS_PLI }}/conf/application.conf"
    - /etc/passwd

First and second shell output are ok, the files exist, location is good, but the third shell outputs only /etc/passwd

I would like the third shell output to be one of {{ pli_loc.stdout }} or {{ cms_loc.stdout}}

Why doesn't it find one of the first ones?


Brian Coca

unread,
Mar 4, 2016, 10:17:05 AM3/4/16
to ansible...@googlegroups.com
lookups (stuff after with_) execute always on the 'master' not on the target machine, so the files have to be accessible on that path on the machine that runs ansible.

--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/54e293db-6b91-4d23-b68f-91ca9dc496c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
----------
Brian Coca
Reply all
Reply to author
Forward
0 new messages