Hi Josh,

The various "with_" operators in ansible are generic so this shouldn't be
specific to the template module, but that does seem a bit curious.

I amw ondering if it's because with_first_found is not returning an
os.path.abspath or has some weird logic in there.

Can you please file a bug on this one so we can look at it?

Thanks!




On Wed, Sep 3, 2014 at 10:03 AM, Josh Smift <[email protected]> wrote:

> We've got a task like this:
>
>   - name: template TrustedHosts
>     template: dest=/etc/opendkim/TrustedHosts src={{ item }} backup=yes
>     with_first_found:
>       - TrustedHosts.{{ stack }}
>       - TrustedHosts.default
>
> There are three hosts that use the playbook this is in, and when Ansible
> gets to this task, it says
>
>    TASK: [../../shared/roles/opendkim | template TrustedHosts]
> *******************
>     fatal: [host3] => {'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}
>     fatal: [host2] => {'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}
>     fatal: [host3] => {'msg': 'One or more items failed.', 'failed': True,
> 'changed': False, 'results': [{'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}]}
>     fatal: [host2] => {'msg': 'One or more items failed.', 'failed': True,
> 'changed': False, 'results': [{'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}]}
>     fatal: [hos1] => {'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}
>     fatal: [host1] => {'msg': 'One or more items failed.', 'failed': True,
> 'changed': False, 'results': [{'msg': 'unable to read
> /home/jsmift/ansible/shared/roles/opendkim/templates', 'failed': True}]}
>
> (Hostnames changed to protect the innocent.)
>
> It works fine if I change it to
>
>   - name: template TrustedHosts
>     template: dest=/etc/opendkim/TrustedHosts src={{ item }} backup=yes
>     with_first_found:
>       - ../templates/TrustedHosts.{{ stack }}
>       - ../templates/TrustedHosts.default
>
> That suggests to me that it's searching relative to the 'files' directory
> of this role; I had expected it to search relative to the 'templates'
> directory, since this task uses the template module.
>
> Should the initial task work as written (i.e. is this a bug)? If not, is
> there a better way to do this, or is "../templates" the right answer?
>
>                                       -Josh ([email protected])
>
>
>
> This email is intended for the person(s) to whom it is addressed and may
> contain information that is PRIVILEGED or CONFIDENTIAL. Any unauthorized
> use, distribution, copying, or disclosure by any person other than the
> addressee(s) is strictly prohibited. If you have received this email in
> error, please notify the sender immediately by return email and delete the
> message and any attachments from your system.
>
> --
> 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/21511.8133.594908.208566%40gargle.gargle.HOWL
> .
> 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/CA%2BnsWgzCkgjZZ6JfyRg23axcbi5mRONPcbxJTRbz7CRF6QU%2BfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to