fix(tailscale): harden removal, restarts and the auth key check
Build / build (pull_request) Successful in 29s
Lint / lint (pull_request) Successful in 2m25s
Molecule / molecule (pull_request) Failing after 3m23s

- Removal passes on a host without a tailscaled unit, and the
  best-effort logout reports a change only when it succeeded.
- Under --check the service tasks run only when the unit exists, also
  with --tags configure on a host without the package.
- The auth key is required before any change only when the run includes
  the configure tasks; --tags remove, install and update need none. The
  assert in the up block stays as the hard guard.
- When the flags change or tailscaled is not active, the role clears its
  failure state and restarts it at once, so a daemon the package started
  without a TUN device does not stay in the start limit.
- The health tag is back on the configure include.
- The scenario tests removal without purge (state and defaults kept, a
  second removal passes) and a purge with a state directory the package
  does not delete itself, and waits for tailscaled to be active.

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-26 20:47:49 +00:00
1 parent 80c76b16ee
commit 29165a610f
6 files changed
+190 -29

No files matched your search

+7 -1
View File
@@ -4,7 +4,8 @@
- name: Log Tailscale out of the tailnet
become: true
ansible.builtin.command: tailscale logout
changed_when: true
register: __tailscale_logout
changed_when: __tailscale_logout.rc == 0
# 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
@@ -16,6 +17,11 @@
name: tailscaled
state: stopped
enabled: false
register: __tailscale_stop
# A host without the package has no unit; there is nothing to stop then.
failed_when:
- __tailscale_stop is failed
- "'Could not find the requested service' not in __tailscale_stop.msg | default('')"
tags: [tailscale, remove]
- name: Remove Tailscale package