2018-07-30 14:56:33 +00:00
|
|
|
---
|
2019-02-16 10:25:57 +00:00
|
|
|
- name: install synapse with pip into virtualenv
|
|
|
|
block:
|
|
|
|
- name: Install dependencies
|
|
|
|
apt:
|
|
|
|
name:
|
2019-07-27 10:46:46 +00:00
|
|
|
- git
|
2019-02-16 10:25:57 +00:00
|
|
|
- build-essential
|
2019-07-27 10:46:46 +00:00
|
|
|
- python3-dev
|
2022-05-10 11:47:35 +00:00
|
|
|
- python3-virtualenv
|
|
|
|
- python3-pip
|
|
|
|
- python3-setuptools
|
2019-02-16 10:25:57 +00:00
|
|
|
- sqlite3
|
2019-07-27 10:46:46 +00:00
|
|
|
- libffi-dev
|
2019-02-16 10:25:57 +00:00
|
|
|
- libssl-dev
|
|
|
|
- libjpeg-dev
|
|
|
|
- libxslt1-dev
|
|
|
|
- libpq-dev
|
|
|
|
state: present
|
|
|
|
cache_valid_time: 1800
|
2021-10-28 05:10:42 +00:00
|
|
|
register: matrix_synapse_dependencies_pulled
|
|
|
|
until: matrix_synapse_dependencies_pulled is success
|
|
|
|
retries: 10
|
|
|
|
delay: 5
|
2021-05-10 10:27:11 +00:00
|
|
|
tags: ['prepare', 'prepare-synapse']
|
2018-07-30 14:56:33 +00:00
|
|
|
|
2019-02-16 10:25:57 +00:00
|
|
|
- name: Create virtualenv
|
|
|
|
pip:
|
2020-10-02 07:49:51 +00:00
|
|
|
name: >-2
|
|
|
|
{{
|
|
|
|
['pip', 'setuptools']
|
|
|
|
+
|
|
|
|
(['txredisapi>=1.4.7', 'hiredis'] if matrix_synapse_workers_enabled|bool else [])
|
|
|
|
}}
|
2019-02-21 22:17:57 +00:00
|
|
|
virtualenv: "{{ matrix_synapse_base_path }}/env"
|
2019-07-27 10:46:46 +00:00
|
|
|
virtualenv_python: python3
|
2019-02-16 10:25:57 +00:00
|
|
|
extra_args: --upgrade
|
2021-05-10 10:27:11 +00:00
|
|
|
tags: ['prepare', 'prepare-synapse']
|
2018-07-30 14:56:33 +00:00
|
|
|
|
2019-02-16 10:25:57 +00:00
|
|
|
- name: Clone synapse
|
|
|
|
git:
|
|
|
|
repo: https://github.com/matrix-org/synapse
|
2019-02-21 22:17:57 +00:00
|
|
|
dest: "{{ matrix_synapse_base_path }}/synapse"
|
2019-02-16 10:25:57 +00:00
|
|
|
accept_hostkey: yes
|
2020-09-19 09:44:30 +00:00
|
|
|
version: "v{{ matrix_synapse_version }}"
|
2021-10-28 05:10:42 +00:00
|
|
|
register: matrix_synapse_source_cloned
|
|
|
|
until: matrix_synapse_source_cloned is success
|
|
|
|
retries: 10
|
|
|
|
delay: 5
|
2021-05-10 10:27:11 +00:00
|
|
|
tags: ['prepare', 'prepare-synapse']
|
2018-07-30 14:56:33 +00:00
|
|
|
|
2019-02-16 10:25:57 +00:00
|
|
|
- name: Install Synapse
|
|
|
|
pip:
|
2019-07-27 10:46:46 +00:00
|
|
|
name: "{{ matrix_synapse_base_path }}/synapse[matrix-synapse-ldap3,postgres,resources.consent,acme,url_preview]"
|
2019-02-21 22:17:57 +00:00
|
|
|
virtualenv: "{{ matrix_synapse_base_path }}/env"
|
2021-10-28 05:10:42 +00:00
|
|
|
when: matrix_synapse_source_cloned.changed
|
2019-04-08 22:30:30 +00:00
|
|
|
notify: restart matrix-synapse
|
2021-05-10 10:27:11 +00:00
|
|
|
tags: ['deploy', 'deploy-synapse', 'skip_ansible_lint']
|
2019-02-16 10:25:57 +00:00
|
|
|
when: matrix_synapse_deployment_method == "pip"
|
2018-08-17 13:40:32 +00:00
|
|
|
|
2021-05-10 10:27:11 +00:00
|
|
|
- name: Ensure synapse container image is present
|
|
|
|
docker_image:
|
|
|
|
name: "{{ matrix_synapse_container_ref }}:{{ matrix_synapse_container_tag }}"
|
|
|
|
force_source: "{{ matrix_synapse_docker_pull }}"
|
|
|
|
source: pull
|
|
|
|
state: present
|
2021-10-28 05:10:42 +00:00
|
|
|
register: matrix_synapse_container_image_pulled
|
|
|
|
until: matrix_synapse_container_image_pulled is success
|
|
|
|
retries: 10
|
|
|
|
delay: 5
|
2021-05-10 10:27:11 +00:00
|
|
|
when: matrix_synapse_deployment_method == "docker"
|
|
|
|
tags: ['prepare', 'prepare-synapse']
|
|
|
|
|
|
|
|
- name: Ensure synapse container is running
|
2019-02-16 10:25:57 +00:00
|
|
|
docker_container:
|
2020-05-27 16:35:20 +00:00
|
|
|
name: "{{ matrix_synapse_container_name }}"
|
2020-09-19 09:44:30 +00:00
|
|
|
image: "{{ matrix_synapse_container_ref }}:{{ matrix_synapse_container_tag }}"
|
2021-01-04 15:14:16 +00:00
|
|
|
networks: "{{ matrix_synapse_docker_networks }}"
|
|
|
|
etc_hosts: "{{ matrix_synapse_docker_etc_hosts }}"
|
2019-02-16 10:25:57 +00:00
|
|
|
ports: "{{ matrix_synapse_docker_ports }}"
|
2020-06-22 18:35:26 +00:00
|
|
|
labels: "{{ matrix_synapse_docker_labels_complete }}"
|
2021-03-25 11:52:53 +00:00
|
|
|
env: "{{ matrix_synapse_docker_env }}"
|
2021-02-01 15:25:08 +00:00
|
|
|
recreate: "{{ matrix_synapse_docker_recreate }}"
|
2021-02-22 06:21:28 +00:00
|
|
|
entrypoint: "{{ matrix_synapse_docker_entrypoint }}"
|
|
|
|
command: "{{ matrix_synapse_docker_command }}"
|
2020-11-24 07:42:34 +00:00
|
|
|
user: "{{ synapse_user.uid }}:{{ appservice_group.gid }}"
|
2019-12-09 13:47:21 +00:00
|
|
|
volumes: "{{ matrix_synapse_docker_volumes }}"
|
2021-05-10 10:27:11 +00:00
|
|
|
restart_policy: unless-stopped
|
|
|
|
state: started
|
2021-09-22 10:08:03 +00:00
|
|
|
register: matrix_synapse_container_started
|
2019-02-16 10:25:57 +00:00
|
|
|
when: matrix_synapse_deployment_method == "docker"
|
2021-05-10 10:27:11 +00:00
|
|
|
tags: ['deploy', 'deploy-synapse']
|
2021-09-22 10:08:03 +00:00
|
|
|
|
|
|
|
- name: Refresh container certificates if required
|
|
|
|
community.docker.docker_container_exec:
|
|
|
|
container: "{{ matrix_synapse_container_name }}"
|
|
|
|
command: "{{ matrix_synapse_container_certificate_refresh_command }}"
|
|
|
|
user: "{{ matrix_synapse_container_certificate_refresh_user_id }}"
|
|
|
|
when: matrix_synapse_container_certificate_refresh and matrix_synapse_deployment_method == "docker" and matrix_synapse_container_started.changed
|
2022-03-04 06:53:38 +00:00
|
|
|
notify: restart matrix-synapse
|
2021-09-22 10:08:03 +00:00
|
|
|
tags: ['deploy', 'deploy-synapse']
|