For one, thou shalt not use deprecated old style variables, you want this
below:

hostvars[groups[databases[0]]['ansible_hostname']

:)

Ordering in some versions of Ansible is not very predictable.   This was
fixed in 1.4, which releases tomorrow.

They will appear in the order listed in inventory.






On Wed, Nov 20, 2013 at 2:06 PM, Oren Shomron <[email protected]> wrote:

> Hi everyone,
>
> I was under the impression that when using the magic "groups" variable,
> the list order would follow the order as specified in the inventory file.
>
> So for example given the following inventory:
>
> [databases]
> db1
> db2
>
> I expected that  ${hostvars.${groups.databases[0]}.ansible_hostname} would
> expand to 'db1'.
> It now appears to me that might not always be the case.
>
> Can someone give some guidance here as far as what the expected behavior
> should be?
> Is it a list or a set?
>
> Thanks!
>   - Oren
>
> --
> 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].
> For more options, visit https://groups.google.com/groups/opt_out.
>



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

Reply via email to