Q:

How do I mount single files using ansible?

I've got a directory on my remote host that I want to mount into a docker container. The issue with this directory is, that its files and itself need a specific owner and group. First, I've tried:
    ...some code...

        - name: setup jitsi-meet volumes
          file:
            path: "{{ item }}"
            state: directory
            owner: 999   # jvb / jicofo in videobrige / jicofo container
            group: 1000  # jitsi in videobrige / jicofo container
            mode: 0755
          with_items:
            - "{{ CONFIG }}/jicofo"
            - "{{ CONFIG }}/jvb"

    ...some code...

        # Video bridge
        - name: run jitsi-meet jvb image
          docker_container:
            name: jitsi-jvb
            ........
            volumes:
              "{{ CONFIG }}/jvb:/config"
            ........

    ...some code...

Ansible does create the volumes recursively with the required owner and group. So {{ CONFIG }}/jvb and its content have 999:1000 (jvb:jitsi). However, for whatever reason, during mounting only /config has the required owner and group (999:1000 or jvb:jitsi) while the content of /config still has root:root. Then, I've tried to mount file by file (see below), but ansible refused to let me do this. Does anybody know how to fix this?
# Video bridge
- name: run jitsi-meet jvb image
  docker_container:
    name: jitsi-jvb
    ..........
    volumes:
      "{{ CONFIG }}/jvb:/config"
      "{{ CONFIG }}/jvb/logging.properties:/config/logging.properties"
      "{{ CONFIG }}/jvb/sip-communicator.properties:/config/sip-communicator.properties"

The error was:
ERROR! Syntax Error while loading YAML.
did not find expected key

The error appears to have been in '/FAKEPATH/docker-container-jitsi.yml': line 56, column 7, but may be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      "{{ CONFIG }}/jvb:/config"
      "{{ CONFIG }}/jvb/logging.properties:/config/logging.properties"
      ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

A:

This seems like a simple syntax problem to me.
The dashes for your volumeList are missing:
...
volumes:
 - "{{ CONFIG }}/jvb:/config"
 - "{{ CONFIG }}/jvb/logging.properties:/config/logging.properties"
 - "{{ CONFIG }}/jvb/sip-communicator.properties:/config/sip-communicator.properties"
...

