From 731bc022cd41802cc242115ef8f013fd87bcd68a Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Thu, 26 Nov 2026 21:24:10 +0000 Subject: [PATCH] fix(tailscale): tolerate an unloaded tailscaled unit in reset-failed After a removal without purge the role has disabled tailscaled, so the reinstall's postinst does not start it. systemd then unloads the inactive, unreferenced unit, and `systemctl reset-failed tailscaled` exits 1 with "Unit tailscaled.service not loaded.", failing the configure step on both noble and resolute. An unloaded unit has no failure state to clear, and the restart that follows loads it, so that one error is not a failure. Assisted-by: Claude Code:claude-opus-5-5 --- roles/tailscale/tasks/configure.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/roles/tailscale/tasks/configure.yml b/roles/tailscale/tasks/configure.yml index de71c58..62b2cc4 100644 --- a/roles/tailscale/tasks/configure.yml +++ b/roles/tailscale/tasks/configure.yml @@ -75,7 +75,14 @@ - name: Clear the failure state of tailscaled become: true ansible.builtin.command: systemctl reset-failed tailscaled # noqa: command-instead-of-module + register: __tailscale_reset_failed changed_when: false + # systemd unloads an inactive unit nothing references (a disabled one the package did not + # start, e.g. after a removal without purge); it then has no failure state to clear, and the + # restart below loads it. + failed_when: + - __tailscale_reset_failed.rc != 0 + - "'not loaded' not in __tailscale_reset_failed.stderr | default('')" # Not run under --check: the restart below only reports what it would do there. when: not ansible_check_mode