Allow disabling service (#107)

master
tjend 4 years ago committed by GitHub
parent 5178a9a097
commit 2d6e36572b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,6 +24,9 @@ wireguard_conf_group: "{{ 'root' if not ansible_os_family == 'Darwin' else 'whee
# The default mode of the wg.conf file
wireguard_conf_mode: 0600
# The default state of the wireguard service
wireguard_service_enabled: "yes"
wireguard_service_state: "started"
#######################################
# Settings only relevant for Ubuntu

@ -9,9 +9,10 @@
loop:
- stopped
- started
when: >
not wg_syncconf and
not ansible_os_family == 'Darwin'
when:
- not wg_syncconf
- not ansible_os_family == 'Darwin'
- wireguard_service_enabled == "yes"
listen: "reconfigure wireguard"
- name: syncconf wireguard
@ -24,7 +25,8 @@
exit 0
args:
executable: "/bin/bash"
when: >
wg_syncconf and
not ansible_os_family == 'Darwin'
when:
- wg_syncconf
- not ansible_os_family == 'Darwin'
- wireguard_service_enabled == "yes"
listen: "reconfigure wireguard"

@ -133,6 +133,6 @@
- name: Start and enable WireGuard service
service:
name: "wg-quick@{{ wireguard_interface }}"
state: started
enabled: yes
state: "{{ wireguard_service_state }}"
enabled: "{{ wireguard_service_enabled }}"
when: not ansible_os_family == 'Darwin'

Loading…
Cancel
Save