From bbb35c7bcef1c2dfbb02970bf6350cbc613dc45f Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 3 Aug 2026 17:02:26 +0200 Subject: [PATCH] fix(openresty): dump the debug logs from a manager The MODE_DEBUG block of the restart handler carries no host gate, unlike its two siblings in the same file which are pinned to a deployment mode and, in swarm, to IS_STACK_HOST. A handler runs on the host that notified it, and a worker reaches this notify: sys-stk-front-proxy/tasks/main.yml:112-118 is an always-changed `command: true` whose only guard is `not nginx_conf.changed`, and the stack-host template action forces changed:False on workers, so the guard is always satisfied there. On a worker the container_address subshell then exits 64 - resolve-container-id refuses to run off a manager - the substitution collapses to empty, `container logs --tail=200` fails, and failed_when:false plus ignore_errors:true swallow it. The debug task below prints an empty string, so the diagnostic reports "no logs" on exactly the node someone enabled MODE_DEBUG to inspect. container_address returns a string to embed, not a delegation; it decides what is addressed, not from where. delegate_to supplies the second half. STACK_HOST rather than the resolve_host_cid include, because svc-prx-openresty declares placement: manager (meta/services.yml:9), so the task can only run on a manager and the full host resolution buys nothing. In compose STACK_HOST is inventory_hostname, so this is a no-op there. The sibling `container ps -a` stays undelegated: a per-node container listing is legitimately node-local. Diagnostics only - nothing gates on openresty_logs, and MODE_DEBUG defaults to false. Not executed: no swarm worker run reproduces the empty dump. Co-Authored-By: Claude Opus 5 (1M context) --- roles/svc-prx-openresty/handlers/restart_and_validate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/svc-prx-openresty/handlers/restart_and_validate.yml b/roles/svc-prx-openresty/handlers/restart_and_validate.yml index cc93fa7565..a101164285 100644 --- a/roles/svc-prx-openresty/handlers/restart_and_validate.yml +++ b/roles/svc-prx-openresty/handlers/restart_and_validate.yml @@ -62,6 +62,7 @@ changed_when: false failed_when: false ignore_errors: true + delegate_to: "{{ STACK_HOST }}" - ansible.builtin.debug: msg: |