ansible/roles/docker/tasks/services/matrix_riot.yml

114 lines
2.8 KiB
YAML

---
- name: create matrix volume folders
file:
name: "{{ matrix.volume_folder }}/{{ volume }}"
state: directory
owner: "991"
group: "991"
loop:
- "data"
- "data/uploads"
- "data/media"
loop_control:
loop_var: volume
- name: create matrix DB folder
file:
name: "{{ matrix.volume_folder }}/db"
state: "directory"
- name: create riot volume folders
file:
name: "{{ riot.volume_folder }}/{{ volume }}"
state: directory
loop:
- "data"
loop_control:
loop_var: volume
- name: matrix network
docker_network:
name: matrix
- name: upload riot config.json
template:
src: files/configs/riot/config.json
dest: "{{ riot.volume_folder }}/data/config.json"
- name: upload riot.im.conf
template:
src: files/configs/riot/riot.im.conf
dest: "{{ riot.volume_folder }}/data/riot.im.conf"
- name: upload vhost config for root domain
template:
src: files/configs/matrix/vhost-root
dest: "{{ nginx.volume_folder }}/vhost/{{ base_domain }}"
- name: upload vhost config for matrix domain
template:
src: files/configs/matrix/vhost-matrix
dest: "{{ nginx.volume_folder }}/vhost/{{ matrix.domain }}"
- name: upload homeserver.yaml
template:
src: "files/configs/matrix/homeserver.yaml"
dest: "{{ matrix.volume_folder }}/data/homeserver.yaml"
- name: upload matrix logging config
template:
src: "files/configs/matrix/matrix.data.coop.log.config"
dest: "{{ matrix.volume_folder }}/data/matrix.data.coop.log.config"
- name: matrix database container
docker_container:
name: matrix_db
image: postgres:10
state: started
restart_policy: always
networks:
- name: matrix
volumes:
- "{{ matrix.volume_folder }}/db:/var/lib/postgresql/data"
env:
POSTGRES_USER: "synapse"
POSTGRES_PASSWORD: "{{ postgres_passwords.matrix }}"
- name: matrix container
docker_container:
name: matrix
image: matrixdotorg/synapse:v0.99.2
restart_policy: unless-stopped
networks:
- name: matrix
published_ports:
- "8008"
volumes:
- "{{ matrix.volume_folder }}/data:/data"
env:
SYNAPSE_CONFIG_PATH: "/data/homeserver.yaml"
SYNAPSE_LOG_LEVEL: "INFO"
VIRTUAL_HOST: "{{ matrix.domain }}"
VIRTUAL_PORT: "8008"
LETSENCRYPT_HOST: "{{ matrix.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
- name: riot container
docker_container:
name: riot_app
image: avhost/docker-matrix-riot:v1.0.3
state: started
restart_policy: always
networks:
- name: matrix
- name: external_services
published_ports:
- "8080"
volumes:
- "{{ riot.volume_folder }}/data:/data"
env:
VIRTUAL_HOST: "{{ riot.domain }}"
VIRTUAL_PORT: "8080"
LETSENCRYPT_HOST: "{{ riot.domain }}"
LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"