diff options
-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: |