Add zerotier and yggdrasil

This commit is contained in:
9pfs 2024-12-21 22:41:16 -08:00
parent 83791fad61
commit 7c9d7ce9a3
Signed by: 9pfs
SSH key fingerprint: SHA256:yVO09iotyiNaBzBBvVR8ZTx7SB9VpvJPgR1Ihy1bz3Q
6 changed files with 82 additions and 0 deletions

View file

@ -56,21 +56,25 @@
src: dn42-roa.service
dest: /etc/systemd/system/dn42-roa.service
mode: '0644'
when: ansible_service_mgr == 'systemd'
- name: Add dn42-roa.timer
ansible.builtin.copy:
src: dn42-roa.timer
dest: /etc/systemd/system/dn42-roa.timer
mode: '0644'
when: ansible_service_mgr == 'systemd'
- name: Enable+start dn42-roa.timer
ansible.builtin.systemd_service:
name: dn42-roa.timer
enabled: true
state: started
when: ansible_service_mgr == 'systemd'
- name: Start dn42-roa.service, but ignore failures
ansible.builtin.systemd_service:
name: dn42-roa.service
state: started
ignore_errors: true
when: ansible_service_mgr == 'systemd'
- name: Reload bird
ansible.builtin.systemd_service:
name: bird.service

50
yggdrasil.yml Normal file
View file

@ -0,0 +1,50 @@
- hosts: routers
remote_user: root
tasks:
- name: fetch gpg key locally
ansible.builtin.command: gpg --fetch-keys https://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/key.txt
delegate_to: 127.0.0.1
run_once: true
- name: export gpg key
ansible.builtin.command: gpg --output yggdrasil/yggdrasil-keyring.gpg --export BC1BF63BD10B8F1A
delegate_to: 127.0.0.1
run_once: true
- name: See if it's possible to run yggdrasil
ansible.builtin.stat:
path: /dev/net/tun
register: can_use_tun
- name: Create /usr/local/apt-keys on debian hosts
ansible.builtin.file:
path: /usr/local/apt-keys
state: directory
mode: '0755'
when: ansible_distribution == 'Debian' and can_use_tun.stat.exists == True
- name: add dirmngr on debian hosts
ansible.builtin.apt:
name: dirmngr
state: latest
when: ansible_distribution == 'Debian' and can_use_tun.stat.exists == True
- name: Copy gpg keyring to debian hosts
ansible.builtin.copy:
src: yggdrasil/yggdrasil-keyring.gpg
dest: /usr/local/apt-keys/yggdrasil-keyring.gpg
mode: '0644'
when: ansible_distribution == 'Debian' and can_use_tun.stat.exists == True
- name: Copy yggdrasil sources list list to debian hosts
ansible.builtin.copy:
src: yggdrasil/debian-list.txt
dest: /etc/apt/sources.list.d/yggdrasil.list
mode: '0644'
when: ansible_distribution == 'Debian' and can_use_tun.stat.exists == True
- name: add yggdrasil on arch systems
ansible.builtin.pacman:
name: yggdrasil
state: present
when: ansible_distribution == 'Archlinux' and can_use_tun.stat.exists == True
- name: add yggdrasil on debian systems
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 1
name: yggdrasil
state: present
when: ansible_distribution == 'Debian' and can_use_tun.stat.exists == True

View file

@ -0,0 +1 @@
deb [signed-by=/usr/local/apt-keys/yggdrasil-keyring.gpg] http://neilalexander.s3.dualstack.eu-west-2.amazonaws.com/deb/ debian yggdrasil

Binary file not shown.

13
zerotier.yml Normal file
View file

@ -0,0 +1,13 @@
- name: Configure zerotier on routers
hosts: routers
remote_user: root
tasks:
- name: copy zerotier .network file
ansible.builtin.template:
src: ztwfugvwdo.network.tmpl
dest: /etc/systemd/network/ztwfugvwdo.network
mode: '0644'
when: ansible_service_mgr == 'systemd'
- name: reload systemd-networkd
command: networkctl reload
when: ansible_service_mgr == 'systemd'

14
ztwfugvwdo.network.tmpl Normal file
View file

@ -0,0 +1,14 @@
[Match]
Name=ztwfugvwdo
[Network]
DHCP=false
IPv6AcceptRA=false
IPv4Forwarding=true
IPv6Forwarding=true
LLDP=true
EmitLLDP=customer-bridge
LinkLocalAddressing=false
[Address]
Address={{ llv6 }}/64