Brian, *that's exactly what i needed !!* thanks so much ! On Thursday, September 10, 2015 at 10:35:29 AM UTC-3, Brian Coca wrote: > > i think you want: > > groups['group_slaves'][groups['group_masters].index(inventory_hostname)] > > supposing you are using hosts: group_masters, reverse it if you are > looping through slaves. > > On Wed, Sep 9, 2015 at 11:06 PM, Alejandro Comisario > <[email protected] <javascript:>> wrote: > > Hi everyone, so happy to be here, this is my first post. > > Here's what i need. > > > > I have two groups: > > > > [group_master] > > host1 > > host2 > > host3 > > > > [group_slaves] > > host4 > > host5 > > host6 > > > > i need to create a template that reflect a pair of "couples" like > > host1 and host4 > > host2 and host4 > > host3 and host6 > > > > for that i thought going through the group_master and then do something > like > > this on the template. > > > > possition_in_the_group = ANSIBLE_VARIABLE_THAT_DONT_KNOW_IF_EXISTS > > master = {{ ansible_hostname }} > > slave = {{ groups['group_slaves'][possition_in_the_group] }} > > > > so, can i know through a simple variable and not having to jinja > "script" to > > know it, the position of the host im running the task on, has in the > group > > it belongs ? > > thanks so much ! > > > > -- > > 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:>. > > To view this discussion on the web visit > > > https://groups.google.com/d/msgid/ansible-project/cccab836-89c4-4ad7-a514-5d422d31686a%40googlegroups.com. > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > 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/a945f678-7b1b-4508-9788-3908602f7206%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
