From 96e7a0f8d2dbaa34f59c156f95c9adacedb251db Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Fri, 7 May 2021 02:38:49 -0400 Subject: [PATCH] Restart WireGuard on configuration update --- roles/base/handlers/main.yml | 6 ++++++ roles/base/tasks/wireguard.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/roles/base/handlers/main.yml b/roles/base/handlers/main.yml index 9d9c0c9..2abd1aa 100644 --- a/roles/base/handlers/main.yml +++ b/roles/base/handlers/main.yml @@ -4,3 +4,9 @@ connect_timeout: 5 listen: reboot_host when: allow_reboot + +- name: Restart WireGuard + service: + name: wg-quick@wg0 + state: restarted + listen: restart_wireguard diff --git a/roles/base/tasks/wireguard.yml b/roles/base/tasks/wireguard.yml index 81f17b2..7c6bd3c 100644 --- a/roles/base/tasks/wireguard.yml +++ b/roles/base/tasks/wireguard.yml @@ -41,6 +41,8 @@ template: src: wireguard.j2 dest: /etc/wireguard/wg0.conf + notify: + - restart_wireguard - name: Start WireGuard interface service: