--- - name: Create synapse volume become: true community.docker.docker_volume: name: synapse - name: Create root-owned synapse config dir become: true ansible.builtin.file: path: /etc/synapse state: directory mode: "1700" owner: root - name: Create nested synapse config dir owned by synapse user become: true ansible.builtin.file: path: /etc/synapse/_data state: directory mode: "1700" owner: "991" - name: Copy synapse config become: true ansible.builtin.template: src: synapse.yaml.j2 dest: /etc/synapse/_data/homeserver.yaml owner: "991" mode: "0600" register: serverconf - name: Copy synapse log config become: true ansible.builtin.template: src: log.config.j2 dest: /etc/synapse/_data/log.config owner: "991" mode: "0600" register: logconf - name: Create synapse container become: true community.docker.docker_container: name: synapse image: matrixdotorg/synapse:v1.116.0 volumes: - synapse:/data - /etc/synapse/_data:/etc/synapse:ro env: SYNAPSE_CONFIG_PATH: /etc/synapse/homeserver.yaml networks: - name: postgresql - name: haproxy restart_policy: unless-stopped recreate: "{{ serverconf.changed or logconf.changed }}"