Files
Kamino/roles/tailscale/tasks/install.yml
T
Defame1297 80c76b16ee 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
2026-11-26 19:08:25 +00:00

42 lines
1.3 KiB
YAML

---
- name: Ensure APT keyrings directory exists
become: true
ansible.builtin.file:
path: "{{ tailscale_keyring_path | dirname }}"
state: directory
mode: "0755"
tags: [tailscale, install]
- name: Install Tailscale APT keyring
become: true
ansible.builtin.get_url:
url: "{{ tailscale_keyring_url }}"
dest: "{{ tailscale_keyring_path }}"
checksum: "sha256:{{ tailscale_keyring_checksum }}"
mode: "0644"
tags: [tailscale, install]
# Same content as upstream's <release>.tailscale-keyring.list.
- name: Install Tailscale APT source list
become: true
ansible.builtin.copy:
dest: "{{ tailscale_apt_list_path }}"
content: |
# Tailscale packages for {{ tailscale_apt_distribution }} {{ tailscale_apt_release }}
deb [signed-by={{ tailscale_keyring_path }}] {{ tailscale_repo_url }} {{ tailscale_apt_release }} main
mode: "0644"
register: __tailscale_apt_source
tags: [tailscale, install]
- name: Install Tailscale package
become: true
ansible.builtin.apt:
name: "{{ tailscale_package }}"
state: present
update_cache: true
register: __tailscale_package_install
notify: Restart tailscaled
# Under --check a new source line is only simulated, so apt would find no tailscale package.
when: not ansible_check_mode or __tailscale_apt_source is not changed
tags: [tailscale, install]