fix(tailscale): tolerate an unloaded tailscaled unit in reset-failed
Build / build (pull_request) Successful in 26s
Lint / lint (pull_request) Canceled after 2m8s
Molecule / molecule (pull_request) Canceled after 1m37s

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
This commit is contained in:
Defame1297 committed 2026-11-26 21:24:10 +00:00
1 parent 29165a610f
commit 731bc022cd
1 file changed
+7
+7
View File
@@ -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