1
0
Fork 0
This repository has been archived on 2020-08-04. You can view files and clone it, but cannot push or open issues or pull requests.
ansible-role-wireguard/handlers/main.yml
Robert Wimmer 3322faf576
Shell best practice (#40)
* add shell options to syncconf handler to fail fast in case of error

* update CHANGELOG
2020-02-04 22:17:00 +01:00

21 lines
629 B
YAML

---
- name: restart wireguard
service:
name: "wg-quick@{{ wireguard_interface }}"
state: restarted
when: not wg_syncconf
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
listen: "reconfigure wireguard"