I don't think you need the nested {{}}. Jinja takes something similar to
python code when it renders the templates.
so
zookeeper.connect={{ groups['zookeeper'] | join( ':' + zookeeper_port + ','
) }}:{{ zookeeper_port }}
should work. I didn't test this out myself but I think thats correct.
Tony
On Thursday, November 5, 2015 at 2:23:38 PM UTC-8, Roy wrote:
>
> I have following host group
>
> [zookeeper]
> zk001.abc.cc zookeeper_myid=1
> zk002.abc.cc zookeeper_myid=2
> zk003.abc.cc zookeeper_myid=3
>
>
> I want following to be created when playbook run
>
> zookeeper.connect=zk001.abc.cc: 2181,zk002.abc.cc: 2181,zk003.abc.cc:2181
>
>
> I tried following in a template which worked
>
> zookeeper.connect={{ groups['zookeeper']|join(':2181,') }}:2181
>
> but now I want to use *zookeeper_port* var instead of *2181*, so I tried
> following but it didn't worked.
>
> zookeeper.connect={{ groups['zookeeper' ]|join(':{{ zookeeper_port }},')
> }}:{{ zookeeper_port }}
>
>
> Any idea how to do this good way
>
> Thanks
>
--
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/ed265cd2-4719-42c1-896d-81d71d6b9b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.