diff --git a/tasks/tailscale.yml b/tasks/tailscale.yml index d04259b..c6b7e6a 100644 --- a/tasks/tailscale.yml +++ b/tasks/tailscale.yml @@ -1,5 +1,12 @@ --- + - name: check if tailscale up already + ansible.builtin.shell: tailscale status + register: ansible_up + ignore_errors: true + changed_when: false + - name: Get tailscale key + when: ansible_up.rc != 0 become: false ansible.builtin.shell: cat ~/compose-files/secrets.env | grep TS_AUTHKEY | sed 's/^.*TS_AUTHKEY=//' @@ -8,10 +15,12 @@ changed_when: false - name: Set tailscale_authkey + when: ansible_up.rc != 0 ansible.builtin.set_fact: tailscale_authkey: "{{ ansible_key.stdout }}" - name: Run tailscale role + when: ansible_up.rc != 0 include_role: name: artis3n.tailscale vars: