diff --git a/handlers/main.yml b/handlers/main.yml index 41725c0..fb239d9 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,10 @@ --- - name: Restart Wireguard service systemd: - name: "wg-quick@{{ interface_name }} && ping -c 3 -4 {{ server_address }}" + name: "wg-quick@{{ interface_name }}" state: restarted enabled: yes daemon_reload: yes + +- name: Ping Wireguard server + shell: "ping -c 3 -4 {{ server_address }}" diff --git a/tasks/configure.yml b/tasks/configure.yml index bc6c530..278c90d 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -94,3 +94,4 @@ delegate_to: "{{ groups['wireguard_server'][0] }}" notify: - Restart Wireguard service + - Ping Wireguard server diff --git a/tasks/install.yml b/tasks/install.yml index 0421a61..4a7022c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -3,6 +3,7 @@ apt: name: wireguard when: ansible_distribution_major_version|int >= 20 or ansible_distribution_version == '19.10' + notify: Ping Wireguard server - apt_repository: repo: ppa:wireguard/wireguard @@ -15,3 +16,4 @@ state: latest update_cache: yes when: ansible_distribution_major_version|int < 20 and ansible_distribution_version != '19.10' + notify: Ping Wireguard server