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,21 @@
|
||||
---
|
||||
# One failing run: includes the role with the inputs the caller sets on the include, and asserts
|
||||
# that the expected message, not something else, stopped it. Input: tailscale_test_case (name,
|
||||
# expect).
|
||||
- name: "Run the role, case {{ tailscale_test_case.name }}"
|
||||
block:
|
||||
- name: "Include the role, case {{ tailscale_test_case.name }}"
|
||||
ansible.builtin.include_role:
|
||||
name: mortis.kamino.tailscale
|
||||
|
||||
# Only reached when the include returned. The message must not contain the expected
|
||||
# text, so the rescue below cannot mistake it for the failure under test.
|
||||
- name: "Fail because the include returned, case {{ tailscale_test_case.name }}"
|
||||
ansible.builtin.fail:
|
||||
msg: The role accepted the input
|
||||
rescue:
|
||||
- name: "The expected failure stopped the run, case {{ tailscale_test_case.name }}"
|
||||
ansible.builtin.assert:
|
||||
that: tailscale_test_case.expect in (ansible_failed_result.msg | default(''))
|
||||
fail_msg: "Expected '{{ tailscale_test_case.expect }}', got: {{ ansible_failed_result.msg | default('') }}"
|
||||
quiet: true
|
||||
Reference in new issue
Block a user