Could i have instead of :

Servers_1.1
Servers_1.2
Servers_2.1
Servers_2.2
Servers_3.1
Servers_3.2


Call each list

servers

The reason being i dont want to have to hard code names in the jinja2
template of the elements in the lists of backends, depending on the size of
the dictionary i might shink or add hosts/backends and i want the template
to dynamically pick these additions or substractions without a code change
in the template file.

On Wed, Feb 14, 2018 at 6:36 PM, Kai Stian Olstad <
[email protected]> wrote:

> On Wednesday, 14 February 2018 17.07.00 CET Owen Corcoran wrote:
> > keepalived_virtual_ip:
> >   - vip_details_1:
> >     haproxy_vip_name: "AddressCleaner_Development"
> >     ip: "1.0.1.2"
> >     front_end_port: 80
> >     haproxy_backend_servers:
> >        - servers_1.1:
> >           hostname: system12
> >           address: 2.0.0.1
> >        - servers_1.2:
> >           hostname: system13
> >           address: 2.0.0.2
> >
>
> It's not allowed to have . (dot) in variable name only letters, numbers
> and underscores is allowed so servers_1.1: is invalid
>
>
> > {% for item in keepalived_virtual_ip %}
> > backend {{ item.haproxy_vip_name }}_backend
> >     mode tcp
> >     balance source
> >     {% for backend in item.haproxy_backend_servers %}
> >        server {{ backend.hostname }} {{ backend.address }}:{{
> haproxy_vip_port }} maxconn 9000 send-proxy check
> >     {% endfor %}
> > {% endfor %}
> >
>
> Lets say that servers_1.1: is servers_1_1:, the same for server_1.2
>
>
> item.haproxy_backend_server is a list of dictonary, the hostname is not
> backend.hostname but
> backend.servers_1_1.hostname and backend.servers_1_2.hostname
>
>
> --
> Kai Stian Olstad
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/JsvtwiHeyvE/unsubscribe.
> To unsubscribe from this group and all its topics, 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/3490142.gy42nNLA3x%40x1.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Thanks
Owen Corcoran

-- 
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/CAMXBBpiaf-J_-CcG6fcW%3D6gthkea8exuHvgUt7n_rS%3DGHz5SPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to