Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add temporary fix to make sure ZeroTier restarts correctly. #16

Merged
merged 11 commits into from
Nov 19, 2024
8 changes: 6 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ zerotier_repo:
base_url_ubuntu: https://download.zerotier.com/debian/
zerotier_version: 1.4.6
zerotier_networks: {}
zerotier_localconfig: {}
zerotier_localconfig:
settings:
primaryPort: 9993
portMappingEnabled: true
allowTcpFallbackRelay: true
zerotier_local_api_address: "localhost:9993"
zerotier_planet: ""
zerotier_ztnet_api_key: ""
zerotier_ztnet_api_base_url: ""
zerotier_ztnet_api_base_url: ""
2 changes: 0 additions & 2 deletions files/systemd-override.conf

This file was deleted.

11 changes: 2 additions & 9 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
---
- name: Stop ZeroTier
- name: Restart ZeroTier
ansible.builtin.systemd:
name: zerotier-one
state: stopped
enabled: true
daemon_reload: true

- name: Start ZeroTier
ansible.builtin.systemd:
name: zerotier-one
state: started
state: restarted
enabled: true
daemon_reload: true
14 changes: 7 additions & 7 deletions tasks/configure_zerotier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
mode: 0644
when: zerotier_planet != ""
notify:
- Stop ZeroTier
- Start ZeroTier
- Restart ZeroTier

- name: Build ZeroTier local config
ansible.builtin.template:
Expand All @@ -24,8 +23,7 @@
group: zerotier-one
mode: 0644
notify:
- Stop ZeroTier
- Start ZeroTier
- Restart ZeroTier

- name: Setup ZeroTier Service Override folder
ansible.builtin.file:
Expand All @@ -36,9 +34,11 @@
group: root

- name: Setup ZeroTier Service Override
ansible.builtin.copy:
src: systemd-override.conf
ansible.builtin.template:
src: systemd-override.conf.j2
dest: /etc/systemd/system/zerotier-one.service.d/ansible.conf
owner: root
group: root
mode: '0644'
mode: 0644
notify:
- Restart ZeroTier
3 changes: 3 additions & 0 deletions templates/systemd-override.conf.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Service]
ExecStartPre=/bin/sh -c '[ -f /var/lib/zerotier-one/planet.custom ] && cp /var/lib/zerotier-one/planet.custom /var/lib/zerotier-one/planet || echo "No custom planet found"'
ExecStartPre=/usr/bin/ss state time-wait sport = {% if 'setting' in zerotier_localconfig and 'primaryPort' in zerotier_localconfig['setting'] %}{{zerotier_localconfig['setting']['primaryPort']}}{% else %}9993{% endif %} -K
6 changes: 6 additions & 0 deletions vars/osmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,43 @@ Ubuntu:
- gpg
- gnupg2
- python3-psutil
- iproute2
bionic:
zerotier_repo: deb https://download.zerotier.com/debian/bionic bionic main
packages:
- gpg
- gnupg2
- python3-psutil
- iproute2
jammy:
zerotier_repo: deb https://download.zerotier.com/debian/jammy jammy main
packages:
- gpg
- gnupg2
- python3-psutil
- iproute2
noble:
zerotier_repo: deb https://download.zerotier.com/debian/noble noble main
packages:
- gpg
- gnupg2
- python3-psutil
- iproute2
Debian:
bullseye:
zerotier_repo: deb https://download.zerotier.com/debian/bullseye bullseye main
packages:
- gpg
- gnupg2
- python3-psutil
- iproute2
bookworm:
zerotier_repo: deb https://download.zerotier.com/debian/bookworm bookworm main
packages:
- gpg
- gnupg2
- python3-psutil
- iproute2
CentOS:
"8":
zerotier_repo: http://download.zerotier.com/redhat/el/8
Expand Down