2018-08-12 22:21:45 +02:00
|
|
|
---
|
|
|
|
- name: restart wireguard
|
|
|
|
service:
|
2019-01-07 22:56:20 +01:00
|
|
|
name: "wg-quick@{{ wireguard_interface }}"
|
2020-04-03 21:59:32 +03:00
|
|
|
state: "{{ item }}"
|
|
|
|
loop:
|
|
|
|
- stopped
|
|
|
|
- started
|
2020-09-22 23:47:10 +02:00
|
|
|
when: >
|
|
|
|
not wg_syncconf and
|
|
|
|
not ansible_os_family == 'Darwin'
|
2020-01-26 23:30:16 +01:00
|
|
|
listen: "reconfigure wireguard"
|
|
|
|
|
|
|
|
- name: syncconf wireguard
|
|
|
|
shell: |
|
2020-02-04 22:17:00 +01:00
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
set -o nounset
|
2020-09-22 23:38:46 +03:00
|
|
|
systemctl is-active wg-quick@{{ wireguard_interface|quote }} || systemctl start wg-quick@{{ wireguard_interface|quote }}
|
2020-01-26 23:30:16 +01:00
|
|
|
wg syncconf {{ wireguard_interface|quote }} <(wg-quick strip /etc/wireguard/{{ wireguard_interface|quote }}.conf)
|
|
|
|
exit 0
|
|
|
|
args:
|
|
|
|
executable: "/bin/bash"
|
2020-09-22 23:47:10 +02:00
|
|
|
when: >
|
|
|
|
wg_syncconf and
|
|
|
|
not ansible_os_family == 'Darwin'
|
2020-01-26 23:30:16 +01:00
|
|
|
listen: "reconfigure wireguard"
|