use wg syncconf if available
This commit is contained in:
parent
f97210d2ad
commit
dc56b0d39e
|
@ -3,3 +3,15 @@
|
|||
service:
|
||||
name: "wg-quick@{{ wireguard_interface }}"
|
||||
state: restarted
|
||||
when: wg_syncconf == "false"
|
||||
listen: "reconfigure wireguard"
|
||||
|
||||
- name: syncconf wireguard
|
||||
shell: |
|
||||
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 == "true"
|
||||
listen: "reconfigure wireguard"
|
||||
|
|
|
@ -39,6 +39,19 @@
|
|||
- wg-generate-keys
|
||||
- wg-config
|
||||
|
||||
- name: Get wg subcommands
|
||||
command: "wg --help"
|
||||
register: wg_subcommands
|
||||
|
||||
- name: Set default value for wg_syncconf variable
|
||||
set_fact:
|
||||
wg_syncconf: "false"
|
||||
|
||||
- name: Check if wg syncconf subcommand is available
|
||||
set_fact:
|
||||
wg_syncconf: "true"
|
||||
when: wg_subcommands.stdout | regex_search('syncconf:')
|
||||
|
||||
- block:
|
||||
- name: Generate WireGuard private key
|
||||
shell: "wg genkey"
|
||||
|
@ -99,7 +112,7 @@
|
|||
tags:
|
||||
- wg-config
|
||||
notify:
|
||||
- restart wireguard
|
||||
- reconfigure wireguard
|
||||
|
||||
- name: Check if reload-module-on-update is set
|
||||
stat:
|
||||
|
|
Reference in a new issue