You want:

{{ hostvars[item].inventory_hostname }}

On Sunday, April 17, 2016, Rick O'Shea <[email protected]> wrote:

> This sort of works:
>
> *- hosts: master*
> *  tasks: *
> *    - name loop through slaves and copy template results to master*
> *      template: src=template.txt dest={item}.txt*
> *      with_items: {{groups.slaves}}*
>
> What I really want is this but it fails since *item* "has no attribute
> 'inventor_hostname'":
>
> *- hosts: master*
> *  tasks: *
> *    - name loop through slaves and copy template results to master*
> *      template: src=template.txt dest={item.inventory_hostname}.txt*
> *      with_items*: {{groups.slaves}}
>
> Assuming that can be made to work, the template.txt also assumes it has
> access to a host, complete with host variables etc.
>
> --
> 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]
> <javascript:_e(%7B%7D,'cvml','ansible-project%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/48938ce6-29eb-4333-95f3-fce5c11cf26f%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/48938ce6-29eb-4333-95f3-fce5c11cf26f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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/CAD8N0v-UN6dFzhoHBNh7VAK9Pn2a%2BY-FQ72ktiMsXDBSpzSP6A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to