diff --git a/handlers/main.yaml b/handlers/main.yaml new file mode 100644 index 0000000..a34ce9b --- /dev/null +++ b/handlers/main.yaml @@ -0,0 +1,9 @@ +--- +- name: Restart tunnels + become: true + service: + name: "wg-quick@{{ item.name }}" + state: restarted + loop: "{{ wireguard_links }}" + loop_control: + label: "{{ item.name }}" \ No newline at end of file diff --git a/tasks/main.yaml b/tasks/main.yaml index 0508327..8b1bf7a 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -23,6 +23,9 @@ loop: "{{ wireguard_links }}" loop_control: label: "{{ item.name }}" + notify: Restart tunnels + +- meta: flush_handlers - name: Enable and start services become: true