2020-01-20 15:56:29 +01:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: Enable https for apt
|
|
|
|
apt: name=apt-transport-https
|
|
|
|
|
|
|
|
- name: Enable matrix apt-key
|
|
|
|
apt_key: url="https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg"
|
|
|
|
|
|
|
|
- name: Enable matrix repository
|
|
|
|
apt_repository: repo="deb https://packages.matrix.org/debian/ {{ ansible_distribution_release }} main"
|
|
|
|
|
|
|
|
- name: Install matrix
|
2020-11-13 18:25:01 +01:00
|
|
|
apt:
|
|
|
|
name:
|
|
|
|
- matrix-synapse-py3
|
|
|
|
- postgresql
|
|
|
|
- python-psycopg2
|
2020-01-20 15:56:29 +01:00
|
|
|
|
|
|
|
- name: Configure PostgreSQL database
|
2020-01-22 13:12:21 +01:00
|
|
|
postgresql_db: name={{ matrix_dbname }} lc_collate=C lc_ctype=C template=template0
|
2020-01-20 15:56:29 +01:00
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
|
|
|
|
- name: Configure PostgreSQL user
|
|
|
|
postgresql_user: db={{ matrix_dbname }} name={{ matrix_dbuser }} password={{ matrix_dbpass }} priv=ALL state=present
|
|
|
|
become: true
|
|
|
|
become_user: postgres
|
|
|
|
|
|
|
|
- name: Configure matrix
|
|
|
|
template: src=matrix-synapse/{{ item }}.j2 dest=/etc/matrix-synapse/{{ item }}
|
|
|
|
with_items:
|
|
|
|
- homeserver.yaml
|
2020-01-30 16:31:04 +01:00
|
|
|
- log.yaml
|
2020-01-20 15:56:29 +01:00
|
|
|
- conf.d/server_name.yaml
|
|
|
|
notify: Restart matrix-synapse
|
|
|
|
|
|
|
|
- name: Ensure certificates are available
|
|
|
|
command: openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/{{ matrix_domain }}.key -out /etc/nginx/ssl/{{ matrix_domain }}.crt -days 730 -subj "/CN={{ matrix_domain }}" creates=/etc/nginx/ssl/{{ matrix_domain }}.crt
|
|
|
|
notify: Restart nginx
|
|
|
|
|
|
|
|
- name: Configure certificate manager for matrix
|
|
|
|
template: src=certs.j2 dest=/etc/acertmgr/{{ matrix_domain }}.conf
|
|
|
|
notify: Run acertmgr
|
|
|
|
|
|
|
|
- name: Configure vhost
|
|
|
|
template: src=vhost.j2 dest=/etc/nginx/sites-available/matrix
|
|
|
|
notify: Restart nginx
|
|
|
|
|
|
|
|
- name: Enable vhost
|
|
|
|
file: src=/etc/nginx/sites-available/matrix dest=/etc/nginx/sites-enabled/matrix state=link
|
|
|
|
notify: Restart nginx
|