diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2024-09-11 20:06:14 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2024-09-11 20:06:14 +0200 |
commit | 6fb7754b9ff1a57ea7a648748bb9e44b94b0c4ea (patch) | |
tree | 98dfd584e426ace72b5a7a682ee936352fea6d2a | |
parent | 490fece7ad354e78a426e239760cf49da15e2bc4 (diff) | |
download | rules-6fb7754b9ff1a57ea7a648748bb9e44b94b0c4ea.tar.gz |
fix(roles/wireguard): absolute path for wg-quick keepalive
-rw-r--r-- | roles/wireguard/tasks/cron.yml | 7 | ||||
-rw-r--r-- | roles/wireguard/tasks/main.yml | 5 |
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: |