delegate_to in Jinja2

16 views
Skip to first unread message

Dewangga Bachrul Alam

unread,
Jan 24, 2016, 9:18:30 PM1/24/16
to ansible...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

I tried to build templates on mariadb (galera) and this templates
should be suites on any additional nodes.

For the example, on the `wsrep_cluster_address`, I put
wsrep_cluster_address = "gcomm://{% if (groups['dbservers']
| length) > 1 %}{% for host in groups['dbservers'] %}{{
hostvars[host]['ansible_ssh_host'] }}{% if not loop.last %},{% endif
%}{% endfor %}{% endif %}"

It's success, but I need to put additional parameter/variable.

I need to put `wsrep_new_cluster` below `wsrep_cluster_address` and it
only `delegate_to` first node/host.

I've read the `delegate_to` parameter on inventory, but I didn't know
how to put it on jinja2 templates. Any ref/docs? Or maybe an example?

Is it possible to do it? Any hints/helps are really appreciated :)
Thank you.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWpYXpAAoJEOV/0iCgKM1wnBkQAJajVkx9/VUhqs1pumPaOwVb
HS9L0hz2JndUgUzgh3Xj1jDbOgCaHXmWjnFZpkas89bHMB7aN4u8SrbZX67Moogd
DAqiYIpxZBx3PNJV5crbqtQldWil+7e+u2WgzERL2Svhjb8ynDVsLyJoej/SkC26
weW0ecQ9UEakJLvUMhmXusBC8lmX1daZ9WRaaSapm+NNziZWuGIp2rPeXBTrs1if
Inurvlq0ljpOMfc7yfUYoPAanOSWNltPsLjMNmJAIV/jlqQE2+yIP+Y0woaPge3o
3mgAkC60rL+/o1mbSEI46FSushPhqNPs40U2TureM8dRNqa7eeXiibEdpOAN8UJz
Q/e6zLyh9phY98mUEDIPJp2yhCPNLaf4QC69B2FFQJjxzTpFuEF+g3Z+vVNJePGT
cDeueRhI+HBmGvnSqIZ3KVl8sP1+ylft0j1GwYamsvqJ50F3gx/NswIKJcYVWpNt
Mo3FsUyHP43sVPMNeC9lXX0o+fx6Xqrg7l+atd9pthoM+SodyhnZjrP4ghBg22OQ
kjMBozaBhTg6GmDegtKLaZ8L9/hLIvDUh4E3Hp53dYZftZYnaQckYhulLyy4TVtf
ysvHexoYjw8bOcYr7f9a3HcZNsG6olLma8rjZjymmq+Tjwvj1x8B+20yg++adxjh
hBaX7+aZJ91ltAhsy/Rp
=RbuT
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages