--- - name: Bring the stack up community.docker.docker_compose_v2: project_src: "{{ stack_dest }}" files: "{{ stack_files }}" state: "{{ stack_state }}" pull: "{{ stack_pull }}" build: "{{ stack_build }}" remove_orphans: true # A compose file that interpolates ${PWD} — a common way to hand a host path to # a sibling container — resolves it against the *invoking shell*, not the # project directory. The module sets the process working directory but not PWD, # so ${PWD} would silently become the SSH login directory. Set it explicitly. environment: "{{ {'PWD': stack_dest} | combine(stack_env) }}"