Files
playbooks/nextcloud/roles
tanshu 90b1149413 Get the reason for a failed Nextcloud unit, not just the state
The second run of this play stopped at "Wait for the Nextcloud unit to become
active" with:

    {"attempts": 2, "cmd": ["systemctl", "--user", "is-active",
     "nextcloud.service"], "rc": 3, "stdout": "failed"}

The wait itself did the right thing: `failed` is not `activating`, so it stopped
immediately instead of retrying for five minutes. But it sat outside the start
block, so the rescue that pulls status, journalctl and podman logs never ran, and
the failure carried no reason at all.

Move the wait inside "Start Nextcloud" so one rescue covers both, and widen the
diagnostics for the failure that is most likely after an interrupted run:

- `systemctl --user cat` -- the generated unit, which settles what systemd thinks
  it is waiting for when a unit sits in `activating`.
- `podman ps -a --filter name=...` -- a container left behind under this name
  makes `podman run` refuse to start, `Restart=always` retries that into systemd's
  start limit, and the unit ends up `failed` while `podman logs` shows only the
  previous container and explains nothing.

The final message now names that case and the commands that clear it, and points
an `activating`-for-the-whole-budget unit at the generated unit and journalctl
instead.
2026-10-16 11:36:29 +05:30
..