Skip to content

Commit

Permalink
only run tailscale if not up already
Browse files Browse the repository at this point in the history
  • Loading branch information
LegitCamper committed Sep 13, 2024
1 parent 73e1aca commit ffea5f1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tasks/tailscale.yml
Original file line number Diff line number Diff line change
@@ -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=//'
Expand All @@ -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:
Expand Down

0 comments on commit ffea5f1

Please sign in to comment.