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,49 @@
|
||||
---
|
||||
# Run with tailscale_remove=true (and tailscale_remove_data=true to purge), tag: remove. main.yml
|
||||
# installs and configures Tailscale again afterwards.
|
||||
- name: Log Tailscale out of the tailnet
|
||||
become: true
|
||||
ansible.builtin.command: tailscale logout
|
||||
changed_when: true
|
||||
# Best effort: already logged out, tailscaled down or binary missing must not block the removal. A
|
||||
# failed logout leaves a stale device in the tailnet admin console.
|
||||
failed_when: false
|
||||
tags: [tailscale, remove]
|
||||
|
||||
- name: Stop and disable tailscaled service
|
||||
become: true
|
||||
ansible.builtin.systemd:
|
||||
name: tailscaled
|
||||
state: stopped
|
||||
enabled: false
|
||||
tags: [tailscale, remove]
|
||||
|
||||
- name: Remove Tailscale package
|
||||
become: true
|
||||
ansible.builtin.apt:
|
||||
name: "{{ tailscale_package }}"
|
||||
state: absent
|
||||
purge: "{{ tailscale_remove_data | bool }}"
|
||||
tags: [tailscale, remove]
|
||||
|
||||
- name: Remove Tailscale APT source list
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ tailscale_apt_list_path }}"
|
||||
state: absent
|
||||
tags: [tailscale, remove]
|
||||
|
||||
- name: Remove Tailscale APT keyring
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ tailscale_keyring_path }}"
|
||||
state: absent
|
||||
tags: [tailscale, remove]
|
||||
|
||||
- name: Remove Tailscale state directory
|
||||
become: true
|
||||
ansible.builtin.file:
|
||||
path: "{{ tailscale_state_dir }}"
|
||||
state: absent
|
||||
when: tailscale_remove_data | bool
|
||||
tags: [tailscale, remove]
|
||||
Reference in new issue
Block a user