From 9e2afff43b43e7f304702e7e960a3c241da043da Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sat, 24 Oct 2026 22:58:33 +0200 Subject: [PATCH] fix(web-app-mastodon,web-app-peertube): loop the vhosts without shadowing domain tasks/utils/load/app.yml hands every loaded application `domain` as an include var, so the vhost loops of Mastodon and PeerTube, which named their item `domain`, made Ansible warn "The loop variable 'domain' is already in use" (full-6 once, full-7 three times, full-8 twice). The loops now name the item front_proxy_vhost and pass it to sys-stk-front-proxy as `domain` in the include vars, which is the name its tasks/main.yml reads; the two loop-var-shadow suppressions go with the shadowing. Evidence: a stub playbook with an outer `domain` include var and a nested include reproduces the warning with the old shape and shows none with the new one; both shapes deliver each vhost to the outer and the nested role, and the outer `domain` is intact after the loop. Co-Authored-By: Claude Opus 5.5 (1M context) --- roles/web-app-mastodon/tasks/00_core.yml | 5 +++-- roles/web-app-peertube/tasks/00_core.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/roles/web-app-mastodon/tasks/00_core.yml b/roles/web-app-mastodon/tasks/00_core.yml index 4e60f56b9b..acba89380f 100644 --- a/roles/web-app-mastodon/tasks/00_core.yml +++ b/roles/web-app-mastodon/tasks/00_core.yml @@ -1,13 +1,14 @@ --- - include_tasks: utils/once/flag.yml -- name: "📂 Include setup for domain '{{ domain }}'" +- name: "📂 Include the front proxy for every {{ application_id }} domain" include_role: name: sys-stk-front-proxy loop: "{{ lookup('domains', 'web-app-mastodon') }}" loop_control: - loop_var: domain # nocheck: loop-var-shadow sys-stk-front-proxy takes the vhost through this name, see its tasks/main.yml front_proxy_domain + loop_var: front_proxy_vhost vars: + domain: "{{ front_proxy_vhost }}" http_port: "{{ lookup('config', application_id, 'services.mastodon.ports.local.http') }}" webserver_websocket_location: "/api/v1/streaming" websocket_port: "{{ lookup('config', application_id, 'services.mastodon.ports.local.websocket') }}" diff --git a/roles/web-app-peertube/tasks/00_core.yml b/roles/web-app-peertube/tasks/00_core.yml index 20269f367b..004dc0774a 100644 --- a/roles/web-app-peertube/tasks/00_core.yml +++ b/roles/web-app-peertube/tasks/00_core.yml @@ -1,13 +1,14 @@ --- - include_tasks: utils/once/flag.yml -- name: "📂 Include front proxy for domain '{{ domain }}'" +- name: "📂 Include the front proxy for every {{ application_id }} domain" include_role: name: sys-stk-front-proxy loop: "{{ lookup('domains', application_id) }}" loop_control: - loop_var: domain # nocheck: loop-var-shadow sys-stk-front-proxy takes the vhost through this name, see its tasks/main.yml front_proxy_domain + loop_var: front_proxy_vhost vars: + domain: "{{ front_proxy_vhost }}" http_port: "{{ lookup('config', application_id, 'services.peertube.ports.local.http') }}" websocket_port: "{{ lookup('config', application_id, 'services.peertube.ports.local.http') }}"