BGP announces
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
parent
86a215c074
commit
fc5f88719c
7 changed files with 70 additions and 7 deletions
|
@ -180,7 +180,49 @@
|
|||
mode: 0640
|
||||
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:
|
||||
- name: restart frr
|
||||
|
|
3
ansible/files/bgp-backup.netdev
Normal file
3
ansible/files/bgp-backup.netdev
Normal file
|
@ -0,0 +1,3 @@
|
|||
[NetDev]
|
||||
Name=bgp-backup
|
||||
Kind=dummy
|
9
ansible/files/bgp-backup.network
Normal file
9
ansible/files/bgp-backup.network
Normal 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
3
ansible/files/bgp.netdev
Normal file
|
@ -0,0 +1,3 @@
|
|||
[NetDev]
|
||||
Name=bgp
|
||||
Kind=dummy
|
5
ansible/files/bgp.network
Normal file
5
ansible/files/bgp.network
Normal file
|
@ -0,0 +1,5 @@
|
|||
[Match]
|
||||
Name=bgp
|
||||
|
||||
[Network]
|
||||
Address={{bgp_ipv6}}
|
|
@ -15,22 +15,23 @@ router bgp {{ bgp_asn }}
|
|||
neighbor {{ bgp_router_ipv6 }} peer-group pg-leaf
|
||||
!
|
||||
address-family ipv4 unicast
|
||||
redistribute connected route-map map-bgp-iface
|
||||
redistribute connected route-map map-bgp
|
||||
neighbor pg-leaf soft-reconfiguration inbound
|
||||
exit-address-family
|
||||
!
|
||||
address-family ipv6 unicast
|
||||
redistribute kernel
|
||||
redistribute connected route-map map-bgp-iface
|
||||
redistribute connected route-map map-bgp
|
||||
neighbor pg-leaf activate
|
||||
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
|
||||
!
|
||||
route-map map-bgp-iface permit 10
|
||||
match interface lo
|
||||
exit
|
||||
route-map map-bgp permit 10
|
||||
match interface bgp
|
||||
route-map map-bgp permit 20
|
||||
match interface bgp-backup
|
||||
set as-path prepend {{ bgp_asn }} {{ bgp_asn }} {{ bgp_asn }}
|
||||
!
|
||||
end
|
||||
|
||||
|
|
0
ansible/files/interface
Normal file
0
ansible/files/interface
Normal file
Loading…
Reference in a new issue