iac/ansible/roles/wireguard/handlers/main.yaml
2025-11-01 17:15:42 +02:00

21 lines
583 B
YAML

---
- name: restart wireguard
ansible.builtin.shell: |
wg syncconf {{ wireguard_interface }} <(wg-quick strip {{ wireguard_interface }})
args:
executable: /bin/bash
ignore_errors: true
register: wg_sync_result
- name: restart wireguard (fallback)
ansible.builtin.systemd:
name: "wg-quick@{{ wireguard_interface }}"
state: restarted
enabled: true
when: wg_sync_result is failed
- name: reload wireguard
ansible.builtin.shell: |
wg syncconf {{ wireguard_interface }} <(wg-quick strip {{ wireguard_interface }})
args:
executable: /bin/bash