From a4841e6947f38943f686c4c0efd3175f6b8989c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoha=C3=AF-Eliel=20BERREBY?= Date: Sat, 1 Aug 2020 12:56:23 +0200 Subject: [PATCH] add radvd role, deploy in routers --- network.yml | 1 + roles/radvd/handlers/main.yml | 4 ++ roles/radvd/tasks/main.yml | 20 +++++++++ roles/radvd/templates/radvd.conf.j2 | 67 +++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 roles/radvd/handlers/main.yml create mode 100644 roles/radvd/tasks/main.yml create mode 100644 roles/radvd/templates/radvd.conf.j2 diff --git a/network.yml b/network.yml index bca43c0..fec4170 100755 --- a/network.yml +++ b/network.yml @@ -25,6 +25,7 @@ - hosts: ~routeur-(pacaterie|edc|fleming|gs).*\.adm\.auro\.re roles: - router + - radvd # Radius (backup only for now) diff --git a/roles/radvd/handlers/main.yml b/roles/radvd/handlers/main.yml new file mode 100644 index 0000000..0bc0b9d --- /dev/null +++ b/roles/radvd/handlers/main.yml @@ -0,0 +1,4 @@ +- name: restart radvd + systemd: + state: restarted + name: radvd diff --git a/roles/radvd/tasks/main.yml b/roles/radvd/tasks/main.yml new file mode 100644 index 0000000..7b68b76 --- /dev/null +++ b/roles/radvd/tasks/main.yml @@ -0,0 +1,20 @@ +--- + + +# Warning: radvd installation seems to fail if the configuration +# file doesn't already exist when the package is installed, +# so the order is important. +- name: Configure radvd + template: + src: radvd.conf.j2 + dest: /etc/radvd.conf + mode: 0644 + notify: restart radvd + +- name: Install radvd + apt: + update_cache: true + name: radvd + state: present + notify: restart radvd + diff --git a/roles/radvd/templates/radvd.conf.j2 b/roles/radvd/templates/radvd.conf.j2 new file mode 100644 index 0000000..e2f91e2 --- /dev/null +++ b/roles/radvd/templates/radvd.conf.j2 @@ -0,0 +1,67 @@ +# -*- mode: conf-unix; coding: utf-8 -*- + +## +# Bornes Wi-Fi +## + +interface ens19 { # XXX - FIX THE INTERFACE NAME + AdvSendAdvert on; + AdvLinkMTU {{ mtu }}; + AdvDefaultPreference high; + MaxRtrAdvInterval 30; + + + prefix 2a09:6840:{{ subnet_ids.ap }}::/64 { + AdvRouterAddr on; + }; + + # La zone DNS + DNSSL borne.auro.re {}; + + # Les DNS récursifs + RDNSS 2a09:6840:{{ subnet_ids.ap }}::{{ dns_host_suffix_main }} {}; + RDNSS 2a09:6840:{{ subnet_ids.ap }}::{{ dns_host_suffix_backup }} {}; +}; + + + + +## +# Utilisateurs filaire +## +interface ens20 { # XXX + AdvSendAdvert on; + AdvLinkMTU {{ mtu }}; + AdvDefaultPreference high; + MaxRtrAdvInterval 30; + + prefix 2a09:6840:{{ subnet_ids.users_wired }}::/64 { + AdvRouterAddr on; + }; + + DNSSL fil.{{ apartment_block_dhcp }}.auro.re {}; # TODO: fix this shitty workaround. + + RDNSS 2a09:6840:{{ subnet_ids.users_wired }}::{{ dns_host_suffix_main }} {}; + RDNSS 2a09:6840:{{ subnet_ids.users_wired }}::{{ dns_host_suffix_backup }} {}; +}; + + +## +# Utilisateurs wifi +## +interface ens20 { # XXX: interface name + AdvSendAdvert on; + AdvLinkMTU {{ mtu }}; + AdvDefaultPreference high; + MaxRtrAdvInterval 30; + + prefix 2a09:6840:{{ subnet_ids.users_wifi }}::/64 { + AdvRouterAddr on; + }; + + DNSSL wifi.{{ apartment_block_dhcp }}.auro.re {}; # TODO: fix this shitty workaround. + + RDNSS 2a09:6840:{{ subnet_ids.users_wifi }}::{{ dns_host_suffix_main }} {}; + RDNSS 2a09:6840:{{ subnet_ids.users_wifi }}::{{ dns_host_suffix_backup }} {}; +}; +