Yes. I managed get the config as below.
{% for host in groups['rabbitmq'] %}
cluster_formation.classic_config.nodes.{{ loop.index }} = rabbit@{{
hostvars[host]['ansible_hostname'] }}
{% endfor %}
On Monday, February 10, 2020 at 1:01:58 PM UTC, Stefan Hornburg (Racke)
wrote:
>
> On 2/10/20 12:21 PM, Bala Mutyam wrote:
> > Hi there,
> >
> > Could someone help me with how to template this config like below
> please?
> >
> > cluster_formation.classic_config.nodes.1 = rabbit@rabbitmq-1
> > cluster_formation.classic_config.nodes.2 = rabbit@rabbitmq-2
> > cluster_formation.classic_config.nodes.3 = rabbit@rabbitmq-3
> >
> >
> > I would like to change nodes.1,2,3 & rabbit@anisble_hostname
>
> So you want to loop over a host group to get this configuration above?
>
> Regards
> Racke
>
> >
> > 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] <javascript:> <mailto:
> [email protected] <javascript:>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/ansible-project/f4b3c9f2-a4b3-4052-86a1-06e6dde25054%40googlegroups.com
>
> > <
> https://groups.google.com/d/msgid/ansible-project/f4b3c9f2-a4b3-4052-86a1-06e6dde25054%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
>
>
>
> --
> Ecommerce and Linux consulting + Perl and web application programming.
> Debian and Sympa administration. Provisioning with Ansible.
>
>
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/e00d8295-9781-4576-9cc2-0f0ea36ed1d6%40googlegroups.com.