template bgp intpeers { local as OWNAS; ipv4 { import where source = RTS_BGP && is_valid_network() && !is_self_net(); export where source = RTS_BGP && is_valid_network() && !is_self_net(); next hop self; add paths yes; }; ipv6 { import where source = RTS_BGP && is_valid_network_v6() && !is_self_net_v6(); export where source = RTS_BGP && is_valid_network_v6() && !is_self_net_v6(); next hop self; add paths yes; }; } {% for host in groups['routers'] %} {% if host != inventory_hostname %} protocol bgp int_{{ hostvars[host]['pop_loc'] }} from intpeers { neighbor {{ hostvars[host]['unicastv6'] }} as OWNAS; } {% endif %} {% endfor %}