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 # The default mode of the wg.conf file
wireguard_conf_mode: 0600 wireguard_conf_mode: 0600
# The default state of the wireguard service
wireguard_service_enabled: "yes"
wireguard_service_state: "started"
####################################### #######################################
# Settings only relevant for Ubuntu # Settings only relevant for Ubuntu

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

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

Loading…
Cancel
Save