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:
1 parent
31634c4eef
commit
80c76b16ee
18 files changed
+943
-3
No files matched your search
@@ -0,0 +1,101 @@
|
||||
---
|
||||
argument_specs:
|
||||
main:
|
||||
short_description: Install Tailscale and bring the node up
|
||||
description:
|
||||
- >-
|
||||
Asserts an Ubuntu host, optionally removes Tailscale first, installs the package from the upstream APT repository
|
||||
with the keyring pinned by sha256, sets the C(tailscaled) flags, enables C(tailscaled), runs C(tailscale up) when
|
||||
C(tailscale_up) is true and the backend state is not Running, and optionally updates the package to the APT
|
||||
candidate version.
|
||||
- Needs gathered facts. It owns no firewall rule. No Tailscale SSH flag and no ACL tag are set.
|
||||
options:
|
||||
tailscale_up:
|
||||
type: bool
|
||||
default: true
|
||||
description:
|
||||
- >-
|
||||
Runs C(tailscale up) when the backend state is not Running. C(tailscale_auth_key) must then be a non-empty
|
||||
string; this is asserted before any change. False installs and runs C(tailscaled) without joining a tailnet.
|
||||
tailscale_auth_key:
|
||||
type: str
|
||||
no_log: true
|
||||
description:
|
||||
- >-
|
||||
Auth key for C(tailscale up), handed over through a root-owned 0600 temporary file that is always removed
|
||||
afterwards. No default. Required, non-empty, when C(tailscale_up) is true and the node is not Running (or
|
||||
C(tailscale_remove) is true); otherwise not read.
|
||||
tailscale_update:
|
||||
type: bool
|
||||
default: false
|
||||
description:
|
||||
- Refreshes the APT cache and installs the package's candidate version, pinned as package=version.
|
||||
tailscale_remove:
|
||||
type: bool
|
||||
default: false
|
||||
description:
|
||||
- >-
|
||||
Logs out (best effort), stops and disables C(tailscaled), removes the package, the APT source list and the
|
||||
keyring, then installs and configures Tailscale again.
|
||||
tailscale_remove_data:
|
||||
type: bool
|
||||
default: false
|
||||
description:
|
||||
- Only used with C(tailscale_remove). Purges the package and deletes C(tailscale_state_dir).
|
||||
tailscale_userspace_networking:
|
||||
type: bool
|
||||
default: false
|
||||
description:
|
||||
- >-
|
||||
Adds C(--tun=userspace-networking) to C(FLAGS) in C(/etc/default/tailscaled) and restarts C(tailscaled), for
|
||||
hosts without C(/dev/net/tun). False removes that flag again. Other flags in C(FLAGS) are kept.
|
||||
tailscale_package:
|
||||
type: str
|
||||
default: tailscale
|
||||
description:
|
||||
- APT package installed, updated or removed.
|
||||
tailscale_apt_distribution:
|
||||
type: str
|
||||
default: ubuntu
|
||||
description:
|
||||
- Distribution directory of the Tailscale repository, used in C(tailscale_repo_url) and the source list comment.
|
||||
tailscale_apt_release:
|
||||
type: raw
|
||||
description:
|
||||
- >-
|
||||
Release codename of the repository suite and of the keyring file name. The role default is the Jinja
|
||||
expression C(ansible_facts['distribution_release']), the host's own release.
|
||||
tailscale_repo_url:
|
||||
type: raw
|
||||
description:
|
||||
- >-
|
||||
APT repository URL written to the source list. The role default is a Jinja expression built from
|
||||
C(tailscale_apt_distribution) (C(https://pkgs.tailscale.com/stable/ubuntu)).
|
||||
tailscale_keyring_url:
|
||||
type: raw
|
||||
description:
|
||||
- >-
|
||||
Download URL of the APT keyring. The role default is a Jinja expression built from C(tailscale_repo_url) and
|
||||
C(tailscale_apt_release) (C(https://pkgs.tailscale.com/stable/ubuntu/<release>.noarmor.gpg)).
|
||||
tailscale_keyring_checksum:
|
||||
type: str
|
||||
default: 3e03dacf222698c60b8e2f990b809ca1b3e104de127767864284e6c228f1fb39
|
||||
description:
|
||||
- >-
|
||||
sha256 (hex) of the keyring at C(tailscale_keyring_url). The download fails on a mismatch, so a rotated
|
||||
upstream key stops the install until the new key is checked and the hash updated.
|
||||
tailscale_keyring_path:
|
||||
type: path
|
||||
default: /usr/share/keyrings/tailscale-archive-keyring.gpg
|
||||
description:
|
||||
- Destination of the downloaded keyring.
|
||||
tailscale_apt_list_path:
|
||||
type: path
|
||||
default: /etc/apt/sources.list.d/tailscale.list
|
||||
description:
|
||||
- Destination of the APT source list.
|
||||
tailscale_state_dir:
|
||||
type: path
|
||||
default: /var/lib/tailscale
|
||||
description:
|
||||
- State directory of C(tailscaled), deleted when C(tailscale_remove_data) is true.
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
galaxy_info:
|
||||
role_name: tailscale
|
||||
namespace: mortis
|
||||
author: Defame1297
|
||||
license: GPL-3.0-or-later
|
||||
description: Install Tailscale from the upstream APT repository and bring the node up with an auth key.
|
||||
min_ansible_version: "2.22"
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- noble
|
||||
- resolute
|
||||
galaxy_tags:
|
||||
- tailscale
|
||||
- vpn
|
||||
- networking
|
||||
dependencies: []
|
||||
Reference in new issue
Block a user