ansible-docker-frr/templates/frr.conf.j2

114 lines
4.0 KiB
Django/Jinja

frr defaults datacenter
hostname {{ansible_hostname}}
!
service integrated-vtysh-config
!
log syslog informational
!
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
{% for item in autobgp_interfaces %}
interface {{ item['name'] }}
ipv6 nd ra-interval 10
no ipv6 nd suppress-ra
!
{% endfor %}
{% endif %}
router bgp {{host_ASN}}
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 != [] %}
neighbor fabric peer-group
neighbor fabric remote-as external
neighbor fabric description Internal Fabric Network
neighbor fabric capability extended-nexthop
{% endif %}
{% 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'] }}
{% endif %}
{% endfor %}
{% endif %}
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
{% for item in autobgp_interfaces %}
neighbor {{ item['name'] }} interface peer-group fabric
{% endfor %}
{% 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'] }}
{% endfor %}
{% endif %}
!
address-family ipv4 unicast
{% if host_loopback_IP is defined %}
network {{host_loopback_IP}}/32
{% endif %}
{% if bgp_redistribute_connected is defined and bgp_redistribute_connected %}
redistribute connected
{% endif %}
{% if networks_to_announce_ipv4 is defined and networks_to_announce_ipv4 != [] %}
{% for item in networks_to_announce_ipv4 %}
network {{ item }}
{% endfor %}
{% 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 != [] %}
{% for item in frr_other_peers %}
neighbor {{ item['ip'] }} remote-as {{ item['remote_ASN'] }} prefix-list AS{{host_ASN}}-OUT out
{% endfor %}
{% 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 %}
exit-address-family
!
address-family ipv6 unicast
{% if host_loopback_IP_v6 is defined %}
network {{host_loopback_IP_v6}}/128
{% 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 %}
{% if autobgp_interfaces is defined and autobgp_interfaces != [] %}
neighbor fabric activate
neighbor fabric prefix-list AS{{host_ASN}}-OUT out
{% 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 %}
exit-address-family
!
address-family l2vpn evpn
neighbor fabric activate
advertise-all-vni
advertise-default-gw
exit-address-family
!
{% if host_loopback_IP is defined %}ip prefix-list AS{{host_ASN}}-OUT seq 5 permit {{host_loopback_IP}}/32{% endif %}
{% if networks_to_announce_ipv4 is defined and networks_to_announce_ipv4 != [] %}
{% for item in networks_to_announce_ipv4 %}
ip prefix-list AS{{host_ASN}}-OUT seq {{loop.index+5}} permit {{ item }}
{% endfor %}
{% endif %}
{% if host_loopback_IP_v6 is defined %}ipv6 prefix-list AS{{host_ASN}}-OUT seq 5 permit {{host_loopback_IP_v6}}/128{% endif %}