From 2836bd3d8541ff3e74901255146883bd653ac1b1 Mon Sep 17 00:00:00 2001 From: olli Date: Sat, 10 Jun 2023 15:07:58 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Ewireguard.yml=E2=80=9C=20=C3=A4ndern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wireguard.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/wireguard.yml b/wireguard.yml index c58dee0..1502bf1 100644 --- a/wireguard.yml +++ b/wireguard.yml @@ -78,6 +78,45 @@ route: yes interface_in: wg0 + - name: Restart service for config changes + copy: + dest: "/etc/systemd/system/wg-ui-restart.service" + content: | + [Unit] + Description=Restart WireGuard + After=network.target + + [Service] + Type=oneshot + ExecStart=/usr/bin/systemctl restart wg-quick@wg0.service + + [Install] + RequiredBy=wg-ui-restart.path + + - name: 'start wg-ui-restart.service' + systemd: + name: wg-ui-restart.service + enabled: true + + - name: Restart service for config changes + copy: + dest: "/etc/systemd/system/wg-ui-restart.path" + content: | + [Unit] + Description=Watch /etc/wireguard/wg0.conf for changes + + [Path] + PathModified=/etc/wireguard/wg0.conf + + [Install] + WantedBy=multi-user.target + + - name: 'add wg-ui-restart.path to startup' + systemd: + name: wg-ui-restart.path + state: started + enabled: true + - name: 'add wireguard to startup' command: systemctl enable wg-quick@wg0.service args: