Escalate stack_dirs from the task, not the file module

become was indented as a module parameter, so any entry setting owner or
group failed. metrics' grafana-data is one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-09-30 15:02:27 +02:00
co-authored by Claude Opus 5.5
parent fbfdb5b375
commit c9a4d56851
+9 -5
View File
@@ -43,11 +43,15 @@
# `owner`/`group` and no `mode`: recursing a mode over live data rewrites the
# permissions of everything the container has already written there.
recurse: "{{ item.recurse | default(omit) }}"
# Escalate only to set an owner or group. Creating these as root would defeat
# the point of pre-creating them at all — callers do it precisely so the bind
# mount is *not* root-owned when Docker first starts the stack. Unescalated
# they land as the deploy user, which is the user Compose runs as.
become: "{{ item.owner is defined or item.group is defined }}"
# Escalate only to set an owner or group. Creating these as root would defeat
# the point of pre-creating them at all — callers do it precisely so the bind
# mount is *not* root-owned when Docker first starts the stack. Unescalated
# they land as the deploy user, which is the user Compose runs as.
#
# A task keyword, at task indentation. One level deeper it is quietly passed to
# the file module as a parameter instead, which fails on the first entry that
# sets owner or group — and lint does not catch it.
become: "{{ item.owner is defined or item.group is defined }}"
loop: "{{ stack_dirs }}"
loop_control:
label: "{{ item.path }}"