xoxys.matrix/tasks/install.yml

77 lines
2.3 KiB
YAML
Raw Permalink Normal View History

2019-01-18 14:52:23 +01:00
---
- name: Prepare base folders
file:
path: "{{ item }}"
state: directory
owner: "{{ matrix_user }}"
group: "{{ matrix_user }}"
mode: 0750
loop:
- "{{ matrix_base_dir }}"
- "{{ matrix_conf_dir }}"
2019-01-19 01:30:45 +01:00
- "{{ matrix_data_dir }}"
2019-01-19 15:09:07 +01:00
- "{{ matrix_log_dir }}"
2019-01-18 14:52:23 +01:00
become: True
become_user: root
- block:
- name: Upgrade python dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
2019-01-18 14:52:23 +01:00
extra_args: --upgrade
loop:
- pip
- setuptools
2019-11-24 16:21:50 +01:00
- name: Install Synapse in virtualenv
2019-01-18 14:52:23 +01:00
pip:
2019-01-19 01:30:45 +01:00
name: matrix-synapse[all]
2019-01-18 14:52:23 +01:00
version: "{{ matrix_version }}"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
2019-02-05 23:02:27 +01:00
notify: __matrix_restart
2019-01-18 14:52:23 +01:00
2019-01-19 22:02:52 +01:00
- name: Install ldap3 auth provider
pip:
name: "matrix-synapse-ldap3"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
2019-06-10 14:06:34 +02:00
when: matrix_ldap_auth_enabled | bool
2019-01-19 22:02:52 +01:00
- name: Deploy existing signing key
copy:
content: "{{ matrix_signing_key }}"
dest: "{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key"
mode: 0600
2021-04-05 17:15:41 +02:00
when: matrix_signing_key is defined
- name: Create new signing key if not provided
shell: '{{ matrix_virtualenv }}/bin/python -c "from signedjson import key; file = open(''{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key'',''w''); key.write_signing_keys(file, [key.generate_signing_key(''first'')]); file.close()"'
2019-01-19 15:06:56 +01:00
args:
2019-01-20 15:02:02 +01:00
creates: "{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key"
2019-01-19 15:06:56 +01:00
notify: __matrix_restart
- name: Deploy global config files
2019-01-18 14:52:23 +01:00
template:
2019-01-19 15:06:56 +01:00
src: "opt/matrix/config/{{ item }}.j2"
dest: "{{ matrix_conf_dir }}/{{ item }}"
mode: 0600
2019-01-19 15:06:56 +01:00
loop:
- "homeserver.yml"
2019-01-19 15:22:55 +01:00
- "logging.config"
2019-01-18 14:52:23 +01:00
notify: __matrix_restart
become: True
become_user: "{{ matrix_user }}"
- block:
- name: Deploy systemd unit file
2019-01-18 14:52:23 +01:00
template:
src: "etc/systemd/system/matrix.service.j2"
dest: "/etc/systemd/system/matrix.service"
2021-02-04 21:42:30 +01:00
mode: 0644
2019-01-18 14:52:23 +01:00
notify: __matrix_restart
become: True
become_user: root