Hi David,

Try {{ servername[iteration] }}

On Thursday, March 19, 2015 at 9:23:17 PM UTC+6, David Vosbury wrote:
>
> I'm not sure if this is the right mailing list group to ask general 
> questions or if this is just for developers. If not, then let me know what 
> the correct group is. Anyway, my question is I'm trying to update some old 
> playbooks to conform to the newer syntax for variables ie. {{ foo }} 
> instead of $foo. In many of these playbooks I pass in a variable from a 
> master includes playbook to sub-playbooks and I then use that variable as a 
> positional parameter to access a specific element in a list. So instead of 
> writing ${servername[0]} I do ${servername[$iteration]} where iteration is 
> my position in the list I want to access in my vars file. I may just 
> rewrite the whole bunch of playbooks to accomplish my task differently but 
> for now I'd just like to update my playbooks to use the newer standard. 
> (Since updating Ansible last time I get the warning that the old variable 
> style will not be supported soon) I don't want to upgrade and find out all 
> my playbooks don't work anymore.
>
> Anyway, I've been trying to figure out how to change the 
> ${servername[$iteration]} to meet the new standards and just can't figure 
> it out. Does anybody know how to do this now?
>

-- 
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/63a56c09-29da-4263-8dcd-fd920358e01c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to