aboutsummaryrefslogtreecommitdiffstats
path: root/roles
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2024-09-11 20:06:14 +0200
committerRomain Gonçalves <me@rgoncalves.se>2024-09-11 20:06:14 +0200
commit6fb7754b9ff1a57ea7a648748bb9e44b94b0c4ea (patch)
tree98dfd584e426ace72b5a7a682ee936352fea6d2a /roles
parent490fece7ad354e78a426e239760cf49da15e2bc4 (diff)
downloadrules-6fb7754b9ff1a57ea7a648748bb9e44b94b0c4ea.tar.gz
fix(roles/wireguard): absolute path for wg-quick keepalive
Diffstat (limited to 'roles')
-rw-r--r--roles/wireguard/tasks/cron.yml7
-rw-r--r--roles/wireguard/tasks/main.yml5
2 files changed, 2 insertions, 10 deletions
diff --git a/roles/wireguard/tasks/cron.yml b/roles/wireguard/tasks/cron.yml
deleted file mode 100644
index 3d723e5..0000000
--- a/roles/wireguard/tasks/cron.yml
+++ /dev/null
@@ -1,7 +0,0 @@
----
-
-- name: add cronjob for keepalive
- ansible.builtin.cron:
- name: keepalive network traffic to domain controller
- user: root
- job: "! ping -c 1 -w 1 {{ hostvars[wireguard__domain_controller].__ip.external }} && wg-quick down {{ wireguard__interface_name }} && wg-quick up {{ wireguard__interface_name }}"
diff --git a/roles/wireguard/tasks/main.yml b/roles/wireguard/tasks/main.yml
index b263e5d..6ef15ea 100644
--- a/roles/wireguard/tasks/main.yml
+++ b/roles/wireguard/tasks/main.yml
@@ -44,11 +44,10 @@
wg-quick up {{ wireguard__interface_name }}
register: wireguard__result_status
-- name: keepalive cronjob every minute
+- name: add cronjob for keepalive
ansible.builtin.cron:
name: keepalive network traffic to domain controller
- user: nobody
- job: ping -c 1 {{ hostvars[wireguard__domain_controller].__ip.external }}
+ job: "! ping -c 1 -w 1 {{ hostvars[wireguard__domain_controller].__ip.internal }} && /usr/local/bin/wg-quick down {{ wireguard__interface_name }} && /usr/local/bin/wg-quick up {{ wireguard__interface_name }}"
- name: show wireguard output
ansible.builtin.debug:
remember that computers suck.