hm, maybe I'd be better off splitting the different location vars into
separate files, and then use
with_first_found
I could then loop over group_names until the node found a valid variable file.
On Thursday, September 10, 2015 at 12:25:14 AM UTC+2, Trond Hindenes wrote:
>
> THanks Brian. I can't seem to get this working. I can access the
> individual items using indexing
> (this works:
> - set_fact: mybackend="{{ db[0] }}"
> )
> But I can't for the life of me figure out how to access by "item name" (or
> if that's even a valid thing in yaml). I can obviously redo the way I
> format the contents of my variable file, but I can't seem to strike gold.
> Struggling to find a good example of this in the docs/examples.
>
> On Thursday, September 10, 2015 at 12:12:43 AM UTC+2, Brian Coca wrote:
>>
>> set_fact:
>> mybackend="{{hostvars[inventory_hostname]['db'][varwithbackendnumber]}}"
>>
>>
>>
>>
>> --
>> Brian Coca
>>
>
--
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/a37f1a42-df34-4dca-b6bf-2d6b5bde9cad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.