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