diff options
Diffstat (limited to 'playbooks.d')
-rw-r--r-- | playbooks.d/vpn-wireguard/playbook.bash | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/playbooks.d/vpn-wireguard/playbook.bash b/playbooks.d/vpn-wireguard/playbook.bash index 5abe24a..a8ed753 100644 --- a/playbooks.d/vpn-wireguard/playbook.bash +++ b/playbooks.d/vpn-wireguard/playbook.bash @@ -48,10 +48,12 @@ playbook_sync() { local data local wgconf local interface + local hash data="$(playbook_path "data")" interface="$(config "$BASHTARD_PLAYBOOK.interface" "wg0")" wgconf="$(config "fs.etcdir")/wireguard/$interface.conf" + hash="$(file_hash "$wgconf")" # Create the wireguard config directory mkdir -pv "$(config "fs.etcdir")/wireguard" @@ -92,9 +94,13 @@ playbook_sync() { # Don't continue here if this was just part of the add invocation [[ "$BASHTARD_COMMAND" == "add" ]] && return + # Nothing left to do if the Wireguard configs are the same + [[ "$hash" == "$(file_hash "$wgconf")" ]] && return + # Refresh the wireguard interface + # A simple reload seems to not discover newly added peers info "$BASHTARD_PLAYBOOK" "Reloading wireguard interface $interface" - systemctl reload "wg-quick@$interface.service" + systemctl restart "wg-quick@$interface.service" } playbook_del() { |