aboutsummaryrefslogtreecommitdiffstats
path: root/roles/wireguard/tasks/service.yml
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-12 14:52:04 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-12 14:54:58 +0000
commitc72bba3be432c661788d93a8cb40defba213a226 (patch)
tree7369313f401ab344610749cd7f2f9851131352ad /roles/wireguard/tasks/service.yml
parent4a16c10dd3b870ce62fdae9b590ff207e30a2bdd (diff)
downloadrules-c72bba3be432c661788d93a8cb40defba213a226.tar.gz
roles/wireguard: Daemon hang with shell module
Using the raw module is a workaround for having wg-quick working in background.
Diffstat (limited to 'roles/wireguard/tasks/service.yml')
-rw-r--r--roles/wireguard/tasks/service.yml16
1 files changed, 9 insertions, 7 deletions
diff --git a/roles/wireguard/tasks/service.yml b/roles/wireguard/tasks/service.yml
index d1a1007..37f3cec 100644
--- a/roles/wireguard/tasks/service.yml
+++ b/roles/wireguard/tasks/service.yml
@@ -10,11 +10,13 @@
when: ansible_distribution == "OpenBSD"
- name: restart wireguard interface
- command: wg-quick "{{ item }}" "{{ wireguard_domain_controller }}"
- ignore_errors: true
- loop:
- - down
- - up
- loop_control:
- pause: 5
+ raw: |
+ wg-quick down {{ wireguard_domain_controller }}
+ sleep {{ 10 | random(start=1) }}
+ wg-quick up {{ wireguard_domain_controller }}
when: ansible_distribution == "OpenBSD"
+ register: result
+
+- name: show wireguard output
+ debug:
+ var: result
remember that computers suck.