initial working commit

This commit is contained in:
2022-10-16 18:54:37 -04:00
commit 1505e39da7
13 changed files with 396 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
---
- name: check for tailscale install
command:
cmd: tailscale status
register: tailscale_status
ignore_errors: yes
- name: check tailscale_status
ansible.builtin.debug:
msg: "{{ tailscale_status }}"
- name: Download Tailscale install script
get_url:
url: https://tailscale.com/install.sh
dest: /tmp/tailscale_install.sh
mode: '0555'
when: tailscale_status.failed
- name: Run Tailscale install script
command:
cmd: /tmp/tailscale_install.sh
when: tailscale_status.failed
- name: Prompt to authorize device
debug:
msg: "Device requires authorization in the TailScale admin panel. Task will wait 60s for you to do so."
when:
- tailscale_status.failed == false
- '"not yet authorized" in tailscale_status.stdout'
- name: Start Tailscale
command:
cmd: /usr/bin/tailscale up --authkey "{{ tailscale_key }}"
async: 60
when: tailscale_status.failed
register: tailscale_start_status
- name: Machine added confirmation
debug:
msg: "Device successfully added to TailScale."
when:
- tailscale_start_status.changed
- '"Success" in tailscale_start_status.stderr'