From 6fb7754b9ff1a57ea7a648748bb9e44b94b0c4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Wed, 11 Sep 2024 20:06:14 +0200 Subject: fix(roles/wireguard): absolute path for wg-quick keepalive --- roles/wireguard/tasks/cron.yml | 7 ------- roles/wireguard/tasks/main.yml | 5 ++--- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 roles/wireguard/tasks/cron.yml (limited to 'roles/wireguard') 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: -- cgit v1.2.3