From 1816e0de71bbcc09254877dccdb7b656aebe4cf0 Mon Sep 17 00:00:00 2001 From: Jeltz Date: Thu, 4 Feb 2021 01:48:40 +0100 Subject: [PATCH] WIP: support for Quagga failover This change probably doesn't work --- roles/ipv6_edge_router/templates/daemons.j2 | 7 +------ roles/router/tasks/main.yml | 7 +++++++ roles/router/templates/keepalived-aurore.conf | 4 ++++ roles/router/templates/notify-quagga.j2 | 21 +++++++++++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 roles/router/templates/notify-quagga.j2 diff --git a/roles/ipv6_edge_router/templates/daemons.j2 b/roles/ipv6_edge_router/templates/daemons.j2 index 957a337..63557b0 100644 --- a/roles/ipv6_edge_router/templates/daemons.j2 +++ b/roles/ipv6_edge_router/templates/daemons.j2 @@ -1,10 +1,5 @@ - -{% if 'backup' in inventory_hostname %} -bgpd=no -{% else %} -zebra=yes bgpd=yes -{% endif %} +zebra=yes ospfd=no ospf6d=no ripd=no diff --git a/roles/router/tasks/main.yml b/roles/router/tasks/main.yml index 2014572..9c40df1 100644 --- a/roles/router/tasks/main.yml +++ b/roles/router/tasks/main.yml @@ -75,6 +75,13 @@ notify: restart keepalived when: "'routeur-aurore' not in ansible_hostname" +- name: install notify-quagga on routeur-aurore* + template: + src: notify-quagga.j2 + dest: /usr/local/sbin/notify-quagga + mode: u=rx,g=r,o=r + when: "'routeur-aurore' in ansible_hostname" + - name: configure keepalived for routeur-aurore* template: src: keepalived-aurore.conf diff --git a/roles/router/templates/keepalived-aurore.conf b/roles/router/templates/keepalived-aurore.conf index cd22a5b..78c0f49 100644 --- a/roles/router/templates/keepalived-aurore.conf +++ b/roles/router/templates/keepalived-aurore.conf @@ -127,5 +127,9 @@ vrrp_instance VI_ROUT_aurore_IPv6 { 2a09:6840:50::/64 via 2a09:6840:129::5:254 dev ens18 2a09:6840:51::/64 via 2a09:6840:129::5:254 dev ens18 } + + notify_master "/usr/local/sbin/notify-quagga master" + notify_backup "/usr/local/sbin/notify-quagga backup" + notify_fault "/usr/local/sbin/notify-quagga fault" } diff --git a/roles/router/templates/notify-quagga.j2 b/roles/router/templates/notify-quagga.j2 new file mode 100644 index 0000000..516d0fa --- /dev/null +++ b/roles/router/templates/notify-quagga.j2 @@ -0,0 +1,21 @@ +#!/bin/bash +{{ ansible_managed | comment }} + +if [[ $# = 0 ]]; then + echo "Invalid number of arguments" >&2 + exit 1 +fi + +case $1 in + master) + systemctl start zebra.service + systemctl start bgpd.service + ;; + backup | fault) + systemctl stop zebra.service + systemctl stop bgpd.service + ;; + *) + echo "Invalid argument" >&2 + exit 1 +esac