29 lines
885 B
YAML
29 lines
885 B
YAML
---
|
|
- name: restart wireguard
|
|
service:
|
|
name: "wg-quick@{{ wireguard_interface }}"
|
|
state: "{{ item }}"
|
|
loop:
|
|
- stopped
|
|
- started
|
|
when: not wg_syncconf and not wireguard_containerized
|
|
listen: "reconfigure wireguard"
|
|
|
|
- name: syncconf wireguard
|
|
shell: |
|
|
set -o errexit
|
|
set -o pipefail
|
|
set -o nounset
|
|
systemctl is-active wg-quick@wg-quick@{{ wireguard_interface|quote }} || systemctl start wg-quick@{{ wireguard_interface|quote }}
|
|
wg syncconf {{ wireguard_interface|quote }} <(wg-quick strip /etc/wireguard/{{ wireguard_interface|quote }}.conf)
|
|
exit 0
|
|
args:
|
|
executable: "/bin/bash"
|
|
when: wg_syncconf and not wireguard_containerized
|
|
listen: "reconfigure wireguard"
|
|
|
|
- name: restart wireguard (container)
|
|
command: s6-svc -r /var/run/s6/services/wireguard
|
|
when: wireguard_containerized
|
|
listen: "reconfigure wireguard"
|