2023-12-22 10:23:42 +01:00
|
|
|
---
|
2024-01-08 15:14:55 +01:00
|
|
|
- name: "include docker-compose-database.yml"
|
|
|
|
include_tasks: docker-compose-database.yml
|
2024-01-02 21:13:34 +01:00
|
|
|
|
2023-12-22 10:23:42 +01:00
|
|
|
- name: "include tasks nginx-docker-proxy-domain.yml"
|
|
|
|
include_tasks: nginx-docker-proxy-domain.yml
|
|
|
|
vars:
|
|
|
|
domain: "{{synapse_domain}}"
|
|
|
|
http_port: "{{synapse_http_port}}"
|
|
|
|
|
|
|
|
- name: "include tasks nginx-docker-proxy-domain.yml"
|
|
|
|
include_tasks: nginx-docker-proxy-domain.yml
|
|
|
|
vars:
|
|
|
|
domain: "{{element_domain}}"
|
|
|
|
http_port: "{{element_http_port}}"
|
|
|
|
|
2024-01-15 01:00:59 +01:00
|
|
|
- name: include create-and-seed-database.yml for multiple bridges
|
|
|
|
include_tasks: create-and-seed-database.yml
|
|
|
|
vars:
|
|
|
|
database_password: "{{ item.database_password }}"
|
|
|
|
database_username: "{{ item.database_username }}"
|
|
|
|
database_name: "{{ item.database_name }}"
|
|
|
|
loop: "{{ bridges }}"
|
|
|
|
|
2024-01-18 18:59:11 +01:00
|
|
|
# The following taks are necessary because a clean setup is necessary
|
|
|
|
- name: shut down docker compose project
|
|
|
|
command:
|
|
|
|
cmd: docker-compose -p "{{docker_compose_project_name}}" down
|
|
|
|
chdir: "{{ docker_compose_instance_directory }}"
|
|
|
|
|
|
|
|
- name: "cleanup project folder"
|
|
|
|
file:
|
|
|
|
path: "{{docker_compose_instance_directory}}"
|
|
|
|
state: absent
|
|
|
|
|
2024-01-15 08:26:05 +01:00
|
|
|
- name: "create registrations folder"
|
|
|
|
file:
|
|
|
|
path: "{{docker_compose_instance_directory}}registrations"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
|
|
|
|
|
|
|
- name: "create bridge folders"
|
2024-01-14 20:08:08 +01:00
|
|
|
file:
|
2024-01-15 01:00:59 +01:00
|
|
|
path: "{{docker_compose_instance_directory}}{{item.bridge_name}}"
|
2024-01-14 20:08:08 +01:00
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2024-01-15 01:00:59 +01:00
|
|
|
loop: "{{ bridges }}"
|
2024-01-14 20:08:08 +01:00
|
|
|
|
2024-01-15 01:00:59 +01:00
|
|
|
- name: add multiple mautrix bridge configuration
|
2023-12-22 10:23:42 +01:00
|
|
|
template:
|
2024-01-15 01:00:59 +01:00
|
|
|
src: "{{item.bridge_name}}.config.yml.j2"
|
|
|
|
dest: "{{docker_compose_instance_directory}}{{item.bridge_name}}/config.yaml"
|
2024-01-14 20:08:08 +01:00
|
|
|
notify: docker compose project setup
|
2024-01-15 01:00:59 +01:00
|
|
|
loop: "{{ bridges }}"
|
2024-01-18 18:59:11 +01:00
|
|
|
notify: docker compose project setup
|
2024-01-14 20:08:08 +01:00
|
|
|
|
|
|
|
- name: add element configuration
|
|
|
|
template:
|
|
|
|
src: "element.config.json.j2"
|
2023-12-22 10:23:42 +01:00
|
|
|
dest: "{{docker_compose_instance_directory}}element-config.json"
|
2023-12-30 16:49:37 +01:00
|
|
|
notify: docker compose project setup
|
2023-12-22 10:23:42 +01:00
|
|
|
|
2024-01-14 20:08:08 +01:00
|
|
|
- name: add synapse homeserver configuration
|
2023-12-22 10:23:42 +01:00
|
|
|
template:
|
2024-01-18 18:59:11 +01:00
|
|
|
src: "synapse/homeserver.yaml.j2"
|
2023-12-22 10:23:42 +01:00
|
|
|
dest: "{{docker_compose_instance_directory}}homeserver.yaml"
|
2023-12-30 16:49:37 +01:00
|
|
|
notify: docker compose project setup
|
2023-12-22 10:23:42 +01:00
|
|
|
|
2024-01-14 20:08:08 +01:00
|
|
|
- name: add synapse log configuration
|
2023-12-22 10:23:42 +01:00
|
|
|
template:
|
2024-01-18 18:59:11 +01:00
|
|
|
src: "synapse/log.config.j2"
|
2023-12-22 10:23:42 +01:00
|
|
|
dest: "{{docker_compose_instance_directory}}{{synapse_domain}}.log.config"
|
2023-12-30 16:49:37 +01:00
|
|
|
notify: docker compose project setup
|
2023-12-22 10:23:42 +01:00
|
|
|
|
|
|
|
# https://github.com/matrix-org/synapse/issues/6303
|
|
|
|
- name: set correct folder permissions
|
|
|
|
command:
|
|
|
|
cmd: "docker run --rm --mount type=volume,src=matrix_synapse_data,dst=/data -e SYNAPSE_SERVER_NAME={{synapse_domain}} -e SYNAPSE_REPORT_STATS=no --entrypoint /bin/sh matrixdotorg/synapse:latest -c 'chown -vR 991:991 /data'"
|
|
|
|
|
|
|
|
- name: add docker-compose.yml
|
|
|
|
template:
|
|
|
|
src: "docker-compose.yml.j2"
|
|
|
|
dest: "{{docker_compose_instance_directory}}docker-compose.yml"
|
2023-12-30 16:49:37 +01:00
|
|
|
notify: docker compose project setup
|
2024-01-14 20:08:08 +01:00
|
|
|
|
|
|
|
- name: flush docker service
|
|
|
|
meta: flush_handlers
|
|
|
|
|
2024-01-15 01:00:59 +01:00
|
|
|
- name: wait for containers
|
|
|
|
pause:
|
|
|
|
seconds: "{{pause_duration}}"
|
2024-01-14 20:08:08 +01:00
|
|
|
|
|
|
|
- name: create registration files
|
|
|
|
command:
|
2024-01-15 01:00:59 +01:00
|
|
|
cmd: docker compose exec {{item.bridge_name}} /usr/bin/{{item.bridge_name}} -g -c /data/config.yaml -r {{registration_file_folder}}{{item.bridge_name}}.registration.yaml
|
2024-01-14 20:08:08 +01:00
|
|
|
chdir: "{{ docker_compose_instance_directory }}"
|
2024-01-15 01:00:59 +01:00
|
|
|
loop: "{{ bridges }}"
|
2024-01-14 20:08:08 +01:00
|
|
|
|
|
|
|
- name: set read and execute permissions for the registration file in the container
|
|
|
|
command:
|
2024-01-15 01:00:59 +01:00
|
|
|
cmd: docker compose exec {{item.bridge_name}} chmod a+rx {{registration_file_folder}}{{item.bridge_name}}.registration.yaml
|
2024-01-14 20:08:08 +01:00
|
|
|
chdir: "{{ docker_compose_instance_directory }}"
|
2024-01-15 01:00:59 +01:00
|
|
|
loop: "{{ bridges }}"
|