Sililar to the example on http://docs.ansible.com/playbooks_loops.html


  - name: build and write /etc/hosts file
    action: template src=templates/{{ item }} dest=/etc/hosts owner=root 
group=root mode=0644
    with_first_found:
      - "etc-hosts.{{ansible_hostname}}.j2"
      - "etc-hosts.j2"

Ansible 1.4.5 fails with the newer 'with_first_found' 
fatal: [backend] => {'msg': 'One or more items failed.', 'failed': True, 
'changed': False, 'results': [{'msg': 'unable to read 
/home/bas/code/iwelcome-ansible/playbooks/hosts/templates/None', 'failed': 
True}]}

When I replace 'with_first_found' with 'first_available_file' it fails in a 
different way:
fatal: [backend] => One or more undefined variables: 'item' is undefined


On May 14, 2014, at 14:01, Serge van Ginderachter <[email protected]> 
wrote:

> 
> On 14 May 2014 13:42, Bas Meijer <[email protected]> wrote:
> PROBLEM: In the playbook below, Ansible 1.4.5 shows 'DEPRECATION WARNING' 
> when I use $item, and 'undefined variables' when in use ​​{{item}}.
> 
> ​​{{item}} is the right syntax
> 
> undefined variables is another problem, is it possible you get no match for 
> first_available_file?
> 
> You might want to use with_first_found instead of the older 
> first_available_file though, then if no match, the task would get skipped.
> 
> 
> 
>   Serge
> 
> 
> 
> -- 
> 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/CAEhzMJD8iiwTqUJhC%3DX5QNB1zQoz6p8DOodVFvZau-X71yMy4Q%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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/C3D37BEF-503D-41D4-ACE4-20B3D0A177DD%40iwelcome.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to