docker swarm – Merge few files in Ansible lookup file

So far I use simple code to deploy Docker stacks. I don’t want to use community.general.docker_stack module, due to its ridiculous requirement: the stack definition (docker compose yml file) needs to be placed at the remote node, while I want to have them all gathered at local manager host. Example code is below (part of role/tasks and vars):

- name: deploy Docker stacks
  command: docker stack deploy --compose-file - {{ item.name }}
  args:
    stdin: "{{ lookup('file', item.source) }}"
  with_items: "{{ docker_swarm_stacks }}"
  when: (docker_swarm_stacks is defined)
docker_swarm_stacks:
  - name: portainer
    source: files/docker_swarm/stacks/portainer.yml
  - name: www-1
    source: files/docker_swarm/stacks/nginx-static.yml
  - name: www-2
    source: files/docker_swarm/stacks/wordpress.yml

So far, so good. With appropriate compose files (placed files/docker_swarm/stacks) in, it works very nice. One stack is created from one yml file (of course one yml file can be used to create similar stacks with different names).
But I would like to improve it and here is a great issue:
I would like to make it possible to use (merge) many compose files as definitions for 1 stack, but the “{{lookup(‘file’, ‘path/to/file.txt’)}}” is limited to 1 file. I’ve already tried to use list of files, but it fails.
Now I don’t have a better idea how to solve it, so I would appreciate if you can share your knowledge and maybe someone has an idea how to solve it.