Ansible keepalived increment int

14 views
Skip to first unread message

Owen Corcoran

unread,
Feb 5, 2018, 12:24:25 PM2/5/18
to Ansible Project
Hi all

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

}

Kai Stian Olstad

unread,
Feb 5, 2018, 1:17:28 PM2/5/18
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages