I was trying to get IPs from multiple hosts instead of their hostnames. I 
found a solution from another thread and adapted it. (...and am just cross 
linking in the hopes of helping the next person http://xkcd.com/979/ :)

https://groups.google.com/d/msg/ansible-project/LWRGQQYPtqs/b7rOazw36vQJ

HTH,
Mark

On Tuesday, December 17, 2013 7:09:52 PM UTC-6, Kahlil Hodgson wrote:
>
> You might be able to chain together the map filter with something 
> (untested) like: 
>
> {{ hostvars.websevers|map(attribute='ansible_fqdn')|join(', ') }} 
>
> Probably need another link in the chain to get a list of vars for a 
> group or some magic slicing. 
>
> K 
>
> Kahlil (Kal) Hodgson                       GPG: C9A02289 
> Head of Technology                         (m) +61 (0) 4 2573 0382 
> DealMax Pty Ltd                            (w) +61 (0) 3 9008 5281 
>
> Suite 1415 
> 401 Docklands Drive 
> Docklands VIC 3008 Australia 
>
> "All parts should go together without forcing.  You must remember that 
> the parts you are reassembling were disassembled by you.  Therefore, 
> if you can't get them together again, there must be a reason.  By all 
> means, do not use a hammer."  -- IBM maintenance manual, 1925 
>
>
>
> On 18 December 2013 11:56, Michael DeHaan 
> <[email protected]<javascript:>> 
> wrote: 
> > Can you get away with using the inventory hostnames?   I'm guessing 
> perhaps 
> > not. 
> > 
> > {{ ",".join(groups.webservers) }} 
> > 
> > It would probably require writing a lookup plugin. 
> > 
> > {{ lookup("jsm_magic_all_my_facts", "webservers", "ansible_hostname") }} 
> > 
> > Others may have better suggestions but that's what my brain is thinking 
> > currently :) 
> > 
> > 
> > 
> > 
> > On Tue, Dec 17, 2013 at 7:39 PM, James Martin 
> > <[email protected]<javascript:>> 
> wrote: 
> >> 
> >> I have a command that needs the fqdn's of all servers within an 
> >> inventory group as input. 
> >> 
> >> - name: run special command 
> >>   command: mycommand "foo.host bar.host baz.host" 
> >> 
> >> 
> >> Is there a simple way to create such a string without having to write 
> >> out a template, cat it, register it, and using the registered 
> >> variable's stdout? 
> >> 
> >> 
> >> Thanks, 
> >> 
> >> James 
> >> 
> >> -- 
> >> 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:>. 
> >> To post to this group, send email to 
> >> [email protected]<javascript:>. 
>
> >> For more options, visit https://groups.google.com/groups/opt_out. 
> > 
> > 
> > 
> > 
> > -- 
> > Michael DeHaan <[email protected] <javascript:>> 
> > CTO, AnsibleWorks, Inc. 
> > http://www.ansibleworks.com/ 
> > 
> > -- 
> > 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:>. 
> > To post to this group, send email to 
> > [email protected]<javascript:>. 
>
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to