On Monday, 5 February 2018 18.24.24 CET Owen Corcoran wrote:
> I have a template I've been working on for keepalived and as part of the 
> template, I want to get it to loop through a list of virtual ips and sub 
> interface eth0 based on the number of virtual ips to manage . What i have so 
> far is below . Any one any ideas ?
> 
> virtual_ipaddress {
> 
> #Virtual IP
> 
> {% for item in keepalived_virtual_ip %}
> 
>         {{ item.address }} dev eth0 label eth0:{{ file_number | int + 1 }}
> 
>     }
> 
>     track_script {
> 
>     haproxy
> 
>     pingable_check_script
> 
>     }

Check out the loop.depth or loop.depth0 varaible that is available in a for loop
http://jinja.pocoo.org/docs/2.10/templates/#for


-- 
Kai Stian Olstad

-- 
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/7490164.9ZZ2GhrzAR%40x1.
For more options, visit https://groups.google.com/d/optout.

Reply via email to