38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
---
|
|
|
|
- name: Tailscale pre-auth key required (skipped if auth key exists)
|
|
fail:
|
|
msg: >
|
|
You must include a Node Pre-Authorization key.
|
|
Set a `tailscale_auth_key` ansible-vault encrypted variable.
|
|
You can create this key from: https://login.tailscale.com/admin/settings/authkeys
|
|
when: tailscale_auth_key is not defined
|
|
|
|
# ansible_distribution == Debian matches Raspbian too
|
|
- name: PreReqs
|
|
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'Debian'
|
|
ansible.builtin.include_tasks: debian.yml
|
|
|
|
- name: Enable Tailscale service
|
|
ansible.builtin.systemd:
|
|
name: "{{ tailscale_service }}"
|
|
state: started
|
|
enabled: yes
|
|
|
|
# on a fresh install, this task returns non-zero return code with
|
|
# "stdout": "Logged out." (task fails, playbook stops here)
|
|
# why am I bothering with these checks, if all it does is causing the playbook to fail?
|
|
- name: Check if Tailscale is connected
|
|
ansible.builtin.command: tailscale status
|
|
changed_when: false
|
|
register: tailscale_status
|
|
failed_when: tailscale_status.rc != 0
|
|
|
|
# - name: Print Tailscale status
|
|
# debug:
|
|
# var: tailscale_status
|
|
# when: verbose | bool
|
|
|
|
- name: Bring up Tailscale.com clients
|
|
ansible.builtin.include_tasks: tailscale.com.yml
|