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}}
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 compare-routerid
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
@ -28,7 +28,7 @@ router bgp {{host_ASN}}
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
{% for item in addressed_interfaces %}
{% if item['bgpPeerIP'] is defined %}
neighbor {{ item['bgpPeerIP'] }} remote-as {{ item['bgpPeerASN'] }}
neighbor {{ item['bgpPeerIP'] }} remote-as {{ item['bgpPeerASN'] }}
{% endif %}
{% endfor %}
{% endif %}
@ -37,43 +37,47 @@ router bgp {{host_ASN}}
neighbor {{ item['name'] }} interface peer-group fabric
{% endfor %}
{% 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 %}
neighbor {{ item['ip'] }} remote-as {{ item['remote_ASN'] }}
{% endfor %}
{% endif %}
!
address-family ipv4 unicast
{% if host_loopback_IP is defined %}
network {{host_loopback_IP}}/32
{% endif %}
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
neighbor fabric activate
neighbor fabric prefix-list AS{{host_ASN}}-OUT out
{% endif %}
{% if frr_other_peers is defined and frr_other_peers != [] %}
{% endif %}
{% if frr_other_peers is defined and frr_other_peers != [] %}
{% for item in frr_other_peers %}
neighbor {{ item['ip'] }} remote-as {{ item['remote_ASN'] }} prefix-list AS{{host_ASN}}-OUT out
{% endfor %}
{% endif %}
{% endif %}
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
{% for item in addressed_interfaces %}
{% if item['bgpPeerIP'] is defined %}
neighbor {{ item['bgpPeerIP'] }} prefix-list AS{{host_ASN}}-OUT out
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
exit-address-family
!
address-family ipv6 unicast
{% if host_loopback_IP_v6 is defined %}
network {{host_loopback_IP_v6}}/128
{% if frr_other_peers is defined and frr_other_peers != [] %}
{% endif %}
{% if frr_other_peers is defined and frr_other_peers != [] %}
{% for item in frr_other_peers %}
neighbor {{ item['ip'] }} prefix-list AS{{host_ASN}}-OUT out
{% endfor %}
{% endif %}
{% endif %}
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
neighbor fabric activate
neighbor fabric prefix-list AS{{host_ASN}}-OUT out
{% endif %}
{% endif %}
{% if addressed_interfaces is defined and addressed_interfaces != [] %}
{% for item in addressed_interfaces %}
{% if item['bgpPeerIP'] is defined %}