global_defs {
  notification_email {
    monitoring.aurore@lists.crans.org
  }
  notification_email_from routeur-aurore{% if 'backup' in inventory_hostname %}-backup{% endif %}@auro.re
  smtp_server smtp.crans.org
}


vrrp_instance VI_ROUT_aurore_IPv4 {
  {% if 'backup' in inventory_hostname %}
  state BACKUP
  priority 100
  {% else %}
  state MASTER
  priority 150
  {% endif %}


  # Interface used for VRRP communication.
  interface ens19

  # Shared by MASTER and BACKUP
  virtual_router_id 40

  # Timeout in seconds before failover kicks in.
  advert_int 2

  # Used to authenticate VRRP communication between master and backup.
  authentication {
    auth_type PASS
    auth_pass {{ keepalived_password }}
  }

  smtp_alert

  virtual_ipaddress {
        # Routing
        10.129.0.254/16 brd 10.129.255.255 dev ens18 scope global

        # Adm
        10.128.0.254/16 brd 10.128.255.255 dev ens19 scope global

        # Switches
        10.130.0.254/16 brd 10.130.255.255 dev ens20 scope global

        # IPs publiques serveurs
        45.66.111.254/24 brd 45.66.111.255 dev ens21 scope global

        # IPs publiques adhérents
        45.66.110.254/24 brd 45.66.110.255 dev ens22 scope global

        # VLAN 131: Onduleurs et PDUs
        10.131.0.254/16 brd 10.131.255.255 dev ens23 scope global
   }


  virtual_routes {
        # IPv4 gateway: yggdrasil
        src 10.129.0.254 to 0.0.0.0/0 via 10.129.0.1 dev ens18
  }
}

vrrp_instance VI_ROUT_aurore_IPv6 {
  {% if 'backup' in inventory_hostname %}
  state BACKUP
  priority 100
  {% else %}
  state MASTER
  priority 150
  {% endif %}


  # Interface used for VRRP communication.
  interface ens19

  # Shared by MASTER and BACKUP
  virtual_router_id 60

  # Timeout in seconds before failover kicks in.
  advert_int 2

  # Used to authenticate VRRP communication between master and backup.
  authentication {
    auth_type PASS
    auth_pass {{ keepalived_password }}
  }

  smtp_alert

  virtual_ipaddress {
        # Hello zayo
        2001:1b48:2:103::d7:2/126 dev ens1 scope global

        # Routing
        2a09:6840:129::254/64 dev ens18 scope global

        # Adm
        2a09:6840:128::254/64 dev ens19 scope global

        # Switches
        2a09:6840:130::254/64 dev ens20 scope global

        # IPs publiques serveurs
        2a09:6840:111::254/64 dev ens21 scope global

        # IPs publiques adhérents
        2a09:6840:110::254/64 dev ens22 scope global

        # VLAN 131: Onduleurs et PDUs
        2a09:6840:131::254/64 dev ens23 scope global
   }


  virtual_routes {
        # For IPv6, the master router is routeur-aurore, NOT yggdrasil,
        # because yggdrasil doesn't support BGPv6 announcements.
        src 2001:1b48:2:103::d7:2/126 to ::/0 via 2001:1b48:2:103::d7:1 dev ens1

        # Routes return for ipv6 connectivity
        2a09:6840:10::/64 via 2a09:6840:129::1:254 dev ens18
        2a09:6840:11::/64 via 2a09:6840:129::1:254 dev ens18
        2a09:6840:20::/64 via 2a09:6840:129::2:254 dev ens18
        2a09:6840:21::/64 via 2a09:6840:129::2:254 dev ens18
        2a09:6840:40::/64 via 2a09:6840:129::4:254 dev ens18
        2a09:6840:41::/64 via 2a09:6840:129::4:254 dev ens18
        2a09:6840:50::/64 via 2a09:6840:129::5:254 dev ens18
        2a09:6840:51::/64 via 2a09:6840:129::5:254 dev ens18
  }
}