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

View File

@ -43,15 +43,19 @@
command: "wg --help" command: "wg --help"
register: wg_subcommands 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: set_fact:
wg_syncconf: "false" wg_syncconf: false
- name: Check if wg syncconf subcommand is available - name: Check if wg syncconf subcommand is available
set_fact: set_fact:
wg_syncconf: "true" wg_syncconf: true
when: wg_subcommands.stdout | regex_search('syncconf:') when: wg_subcommands.stdout | regex_search('syncconf:')
- name: Show syncconf subcommand status
debug:
var: wg_syncconf
- block: - block:
- name: Generate WireGuard private key - name: Generate WireGuard private key
shell: "wg genkey" shell: "wg genkey"