Fantastic timing on this question! I was just about to post the same thing.
Also, since it wasn't initially clear for me, i'll post for the benefit
others:
You can use it this way:
* - debug: msg="{{ hostvars[item].ansible_host }}"*
* with_items: groups.f5loadbalancers*
On Sunday, April 17, 2016 at 10:27:46 PM UTC-4, Matt Martz wrote:
>
> You want:
>
> {{ hostvars[item].inventory_hostname }}
>
> On Sunday, April 17, 2016, Rick O'Shea <[email protected] <javascript:>>
> 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].
>> 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/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/50d5fef8-2b8e-4e74-ab1d-8d1d03a71a5d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.