Allow disabling service (#107)
This commit is contained in:
parent
5178a9a097
commit
2d6e36572b
3 changed files with 13 additions and 8 deletions
|
@ -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…
Reference in a new issue