BGP announces

Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
Frank Villaro-Dixon 2024-06-20 10:16:56 +02:00
parent 86a215c074
commit fc5f88719c
7 changed files with 70 additions and 7 deletions

View file

@ -180,7 +180,49 @@
mode: 0640 mode: 0640
notify: restart frr notify: restart frr
- name: Copy systemd netdevs
ansible.builtin.template:
src: files/{{item}}.netdev
dest: /etc/systemd/network/
owner: root
group: root
mode: 0644
with_items:
- bgp
- bgp-backup
register: netdevs
- name: Copy systemd bgp network
ansible.builtin.template:
src: files/{{item}}.network
dest: /etc/systemd/network/
owner: root
group: root
mode: 0644
with_items:
- bgp
- bgp-backup
register: bgpnetworks
- name: Copy systemd bgp-backup network
ansible.builtin.template:
src: files/bgp-backup.network
dest: /etc/systemd/network/
owner: root
group: root
mode: 0644
register: networks
- name: Reload systemd-networkd
shell: networkctl reload
when: netdevs.changed or networks.changed or bgpnetworks.changed
- name: Enable FRR
service:
name: frr
enabled: yes
state: started
handlers: handlers:
- name: restart frr - name: restart frr

View file

@ -0,0 +1,3 @@
[NetDev]
Name=bgp-backup
Kind=dummy

View file

@ -0,0 +1,9 @@
[Match]
Name=bgp-backup
[Network]
{% for host in groups['all'] -%}
{%- if host != inventory_hostname -%}
Address={{ hostvars[host]['bgp_ipv6'] }}
{% endif -%}
{% endfor %}

3
ansible/files/bgp.netdev Normal file
View file

@ -0,0 +1,3 @@
[NetDev]
Name=bgp
Kind=dummy

View file

@ -0,0 +1,5 @@
[Match]
Name=bgp
[Network]
Address={{bgp_ipv6}}

View file

@ -15,22 +15,23 @@ router bgp {{ bgp_asn }}
neighbor {{ bgp_router_ipv6 }} peer-group pg-leaf neighbor {{ bgp_router_ipv6 }} peer-group pg-leaf
! !
address-family ipv4 unicast address-family ipv4 unicast
redistribute connected route-map map-bgp-iface redistribute connected route-map map-bgp
neighbor pg-leaf soft-reconfiguration inbound neighbor pg-leaf soft-reconfiguration inbound
exit-address-family exit-address-family
! !
address-family ipv6 unicast address-family ipv6 unicast
redistribute kernel redistribute connected route-map map-bgp
redistribute connected route-map map-bgp-iface
neighbor pg-leaf activate neighbor pg-leaf activate
neighbor pg-leaf soft-reconfiguration inbound neighbor pg-leaf soft-reconfiguration inbound
neighbor pg-leaf route-map map-bgp-iface out neighbor pg-leaf route-map map-bgp out
exit-address-family exit-address-family
exit exit
! !
route-map map-bgp-iface permit 10 route-map map-bgp permit 10
match interface lo match interface bgp
exit route-map map-bgp permit 20
match interface bgp-backup
set as-path prepend {{ bgp_asn }} {{ bgp_asn }} {{ bgp_asn }}
! !
end end

0
ansible/files/interface Normal file
View file