feat(tailscale): add the tailscale role

Installs Tailscale from the upstream APT repository with the keyring
pinned by sha256, enables tailscaled and, with tailscale_up (default
true), runs tailscale up with tailscale_auth_key while the node is not
Running. It can also update to the APT candidate version and remove or
purge.

The role asserts Ubuntu and follows the host's release, and requires a
non-empty auth key before any change whenever tailscale up will run.
tailscale_userspace_networking now sets --tun=userspace-networking in
the FLAGS of /etc/default/tailscaled, where tailscaled reads it, instead
of passing it to tailscale up.

The molecule scenario installs the real package on noble and resolute
without joining a tailnet, and covers the update and purge paths and
the refusal cases.

Closes #396

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-26 19:08:25 +00:00
1 parent 31634c4eef
commit 80c76b16ee
18 files changed
+943 -3

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
---
# tailscale_auth_key has no default: it is a secret, required whenever tailscale up has to run.
tailscale_up: true
tailscale_update: false
tailscale_remove: false
tailscale_remove_data: false
# Runs tailscaled without a TUN device, for hosts (containers) that have no /dev/net/tun.
tailscale_userspace_networking: false
tailscale_package: tailscale
tailscale_apt_distribution: ubuntu
# The default keeps argument validation from failing on a play without facts, so the Ubuntu assert
# in tasks/validate.yml gives the reason instead.
tailscale_apt_release: "{{ ansible_facts['distribution_release'] | default('') }}"
tailscale_repo_url: "https://pkgs.tailscale.com/stable/{{ tailscale_apt_distribution }}"
tailscale_keyring_url: "{{ tailscale_repo_url }}/{{ tailscale_apt_release }}.noarmor.gpg"
# sha256 of Tailscale's package signing key (2596A99EAAB33821893C0A79458CA832957F5868), the same
# file for noble and resolute. Static on purpose: a rotated key fails the install until a person
# has checked the new one and updated this hash.
tailscale_keyring_checksum: "3e03dacf222698c60b8e2f990b809ca1b3e104de127767864284e6c228f1fb39"
tailscale_keyring_path: /usr/share/keyrings/tailscale-archive-keyring.gpg
tailscale_apt_list_path: /etc/apt/sources.list.d/tailscale.list
tailscale_state_dir: /var/lib/tailscale