infra/ansible/roles/tailscale/tasks/main.yml
Graham McIntire 292758900e
Add hi (74.50.113.232) with Forgejo + Caddy, bootstrapped support.vntx.net
- DNS: hi.mcintire.me A/AAAA, git.mcintire.me A/AAAA updated to new host
- forgejo role: Docker Compose deployment with SQLite, INSTALL_LOCK, admin user creation
- Caddyfile-hi.j2: reverse proxy git.mcintire.me -> localhost:3000
- tailscale role: skip connect when no auth key; dynamic repo suite
- debian role: fix Signed-By for debian.sources on trixie
- curl added to base Debian packages
- support.vntx.net: added to vntx_servers, DNS, host_vars
2026-07-24 13:12:33 -05:00

55 lines
1.6 KiB
YAML

---
- name: Download Tailscale GPG key
ansible.builtin.get_url:
url: https://pkgs.tailscale.com/stable/debian/bookworm.noarmor.gpg
dest: /usr/share/keyrings/tailscale-archive-keyring.gpg
mode: '0644'
force: false
- name: Add Tailscale repository
ansible.builtin.deb822_repository:
name: tailscale
types: deb
uris: https://pkgs.tailscale.com/stable/debian
suites: "{{ ansible_facts['distribution_release'] }}"
components: main
signed_by: /usr/share/keyrings/tailscale-archive-keyring.gpg
state: present
enabled: true
- name: Install Tailscale
ansible.builtin.apt:
name: tailscale
state: present
update_cache: true
- name: Check if Tailscale is already connected
ansible.builtin.command: tailscale status --json
register: tailscale_status
changed_when: false
failed_when: false
- name: Connect to Tailscale
ansible.builtin.command: "tailscale up --authkey={{ tailscale_authkey }} {{ tailscale_args | default('') }}"
when:
- not (tailscale_skip_connect | default(false))
- tailscale_authkey | length > 0
- tailscale_status.rc != 0 or 'BackendState":"Running"' not in tailscale_status.stdout
register: tailscale_up
changed_when: tailscale_up.rc == 0
- name: Get Tailscale IP address
ansible.builtin.command: tailscale ip -4
register: tailscale_ip_result
changed_when: false
failed_when: false
- name: Set Tailscale IP fact
ansible.builtin.set_fact:
tailscale_ip: "{{ tailscale_ip_result.stdout | trim }}"
when: tailscale_ip_result.rc == 0
- name: Display Tailscale IP
ansible.builtin.debug:
msg: "Tailscale IP: {{ tailscale_ip }}"
when: tailscale_ip_result.rc == 0