Added conditional to the announcment of the IPv6 loopback

Added conditional to the announcment of the IPv4 loopback
Added conditional to the routerID, will use IPv4 loopback if present, if 
not will use ansible 'default 'IP
This commit is contained in:
Cory Hawkless 2020-08-21 21:48:43 +09:30
parent fcb362f604
commit 431b6b1f94
1 changed files with 14 additions and 10 deletions

View File

@ -16,7 +16,7 @@ interface {{ item['name'] }}
router bgp {{host_ASN}} router bgp {{host_ASN}}
bgp router-id {{host_loopback_IP}} bgp router-id {% if host_loopback_IP is defined %}{{host_loopback_IP}}{% else %}{{hostvars[inventory_hostname]['ansible_default_ipv4']['address']}}{% endif %}
bgp bestpath as-path multipath-relax bgp bestpath as-path multipath-relax
bgp bestpath compare-routerid bgp bestpath compare-routerid
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %} {% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
@ -44,7 +44,9 @@ router bgp {{host_ASN}}
{% endif %} {% endif %}
! !
address-family ipv4 unicast address-family ipv4 unicast
{% if host_loopback_IP is defined %}
network {{host_loopback_IP}}/32 network {{host_loopback_IP}}/32
{% endif %}
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %} {% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
neighbor fabric activate neighbor fabric activate
neighbor fabric prefix-list AS{{host_ASN}}-OUT out neighbor fabric prefix-list AS{{host_ASN}}-OUT out
@ -64,7 +66,9 @@ router bgp {{host_ASN}}
exit-address-family exit-address-family
! !
address-family ipv6 unicast address-family ipv6 unicast
{% if host_loopback_IP_v6 is defined %}
network {{host_loopback_IP_v6}}/128 network {{host_loopback_IP_v6}}/128
{% endif %}
{% if frr_other_peers is defined and frr_other_peers != [] %} {% if frr_other_peers is defined and frr_other_peers != [] %}
{% for item in frr_other_peers %} {% for item in frr_other_peers %}
neighbor {{ item['ip'] }} prefix-list AS{{host_ASN}}-OUT out neighbor {{ item['ip'] }} prefix-list AS{{host_ASN}}-OUT out