diff --git a/ansible/roles/podman/tasks/containers/home/zomboid.yml b/ansible/roles/podman/tasks/containers/home/zomboid.yml index d6e9c01..7a9b10f 100644 --- a/ansible/roles/podman/tasks/containers/home/zomboid.yml +++ b/ansible/roles/podman/tasks/containers/home/zomboid.yml @@ -17,7 +17,20 @@ - "{{ zomboid_path }}/server" - "{{ zomboid_path }}/data" - "{{ zomboid_path }}/scripts" - - "{{ zomboid_path }}/logs" + +# Not a container volume -- nothing mounts it. It holds output from host-side +# helpers that run as {{ podman_user }}, so it must be owned by that user rather +# than the container's subuid. Getting this wrong silently broke world resets: +# the script's first log line failed with EACCES and set -e killed it before it +# stopped the server, so `@bot` resets did nothing at all. +- name: create zomboid host-side log directory + become: true + ansible.builtin.file: + path: "{{ zomboid_path }}/logs" + state: directory + owner: "{{ podman_user }}" + group: "{{ podman_user }}" + mode: 0755 - name: create podman bin directory become: true diff --git a/ansible/roles/podman/tasks/main.yml b/ansible/roles/podman/tasks/main.yml index 324ac88..bf5ac42 100644 --- a/ansible/roles/podman/tasks/main.yml +++ b/ansible/roles/podman/tasks/main.yml @@ -123,7 +123,7 @@ - import_tasks: containers/home/gregtime.yml vars: - image: localhost/greg-time-bot:3.16.1 + image: localhost/greg-time-bot:3.16.2 tags: gregtime # Gated on zomboid_enabled (roles/podman/defaults/main.yml) so it can be taken diff --git a/ansible/roles/podman/templates/zomboid/world-reset.sh.j2 b/ansible/roles/podman/templates/zomboid/world-reset.sh.j2 index d37cb23..12fc8d2 100644 --- a/ansible/roles/podman/templates/zomboid/world-reset.sh.j2 +++ b/ansible/roles/podman/templates/zomboid/world-reset.sh.j2 @@ -11,7 +11,12 @@ SAVES_PATH="{{ podman_home }}/.local/share/volumes/zomboid/data/Saves/Multiplaye DB_PATH="{{ podman_home }}/.local/share/volumes/zomboid/data/db/${SERVER_NAME}.db" log() { - echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOGFILE" + local msg="[$(date '+%Y-%m-%d %H:%M:%S')] $1" + echo "$msg" + # stdout is already captured by the journal; the file is a convenience. + # Never let it be fatal -- an unwritable log used to abort the whole wipe + # on the very first line, under set -e. + echo "$msg" >> "$LOGFILE" 2>/dev/null || true } # Ensure XDG_RUNTIME_DIR is set for systemctl --user