3
0
Fork 0

use boolean as variable type for wg_syncconf

This commit is contained in:
githubixx 2020-01-26 22:47:44 +01:00
parent dc56b0d39e
commit 12c30b5b6a
2 changed files with 9 additions and 5 deletions

View File

@ -3,7 +3,7 @@
service:
name: "wg-quick@{{ wireguard_interface }}"
state: restarted
when: wg_syncconf == "false"
when: not wg_syncconf
listen: "reconfigure wireguard"
- name: syncconf wireguard
@ -13,5 +13,5 @@
exit 0
args:
executable: "/bin/bash"
when: wg_syncconf == "true"
when: wg_syncconf
listen: "reconfigure wireguard"

View File

@ -43,15 +43,19 @@
command: "wg --help"
register: wg_subcommands
- name: Set default value for wg_syncconf variable
- name: Set default value for wg_syncconf variable (assume wg syncconf subcommand not available)
set_fact:
wg_syncconf: "false"
wg_syncconf: false
- name: Check if wg syncconf subcommand is available
set_fact:
wg_syncconf: "true"
wg_syncconf: true
when: wg_subcommands.stdout | regex_search('syncconf:')
- name: Show syncconf subcommand status
debug:
var: wg_syncconf
- block:
- name: Generate WireGuard private key
shell: "wg genkey"