20 lines
509 B
YAML
20 lines
509 B
YAML
---
|
|
- name: restart wireguard
|
|
ansible.builtin.service:
|
|
name: "wg-quick@vpn01"
|
|
state: "{{ item }}"
|
|
loop:
|
|
- stopped
|
|
- started
|
|
listen: "reconfigure wireguard"
|
|
- name: syncconf wireguard
|
|
ansible.builtin.shell: |
|
|
set -o errexit
|
|
set -o pipefail
|
|
set -o nounset
|
|
systemctl is-active wg-quick@vpn01 || systemctl start wg-quick@vpn01
|
|
wg syncconf vpn01 <(wg-quick strip /etc/wireguard/vpn01.conf)
|
|
exit 0
|
|
args:
|
|
executable: "/bin/bash"
|
|
listen: "reconfigure wireguard" |