xoxys.matrix/tasks/install.yml

77 lines
2.3 KiB
YAML

---
- name: Prepare base folders
file:
path: "{{ item }}"
state: directory
owner: "{{ matrix_user }}"
group: "{{ matrix_user }}"
mode: 0750
loop:
- "{{ matrix_base_dir }}"
- "{{ matrix_conf_dir }}"
- "{{ matrix_data_dir }}"
- "{{ matrix_log_dir }}"
become: True
become_user: root
- block:
- name: Upgrade python dependencies
pip:
name: "{{ item }}"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
extra_args: --upgrade
loop:
- pip
- setuptools
- name: Install Synapse in virtualenv
pip:
name: matrix-synapse[all]
version: "{{ matrix_version }}"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
notify: __matrix_restart
- name: Install ldap3 auth provider
pip:
name: "matrix-synapse-ldap3"
virtualenv: "{{ matrix_virtualenv }}"
virtualenv_command: "{{ matrix_virtualenv_command }}"
when: matrix_ldap_auth_enabled | bool
- name: Deploy existing signing key
copy:
content: "{{ matrix_signing_key }}"
dest: "{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key"
mode: 0600
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()"'
args:
creates: "{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key"
notify: __matrix_restart
- name: Deploy global config files
template:
src: "opt/matrix/config/{{ item }}.j2"
dest: "{{ matrix_conf_dir }}/{{ item }}"
mode: 0600
loop:
- "homeserver.yml"
- "logging.config"
notify: __matrix_restart
become: True
become_user: "{{ matrix_user }}"
- block:
- name: Deploy systemd unit file
template:
src: "etc/systemd/system/matrix.service.j2"
dest: "/etc/systemd/system/matrix.service"
mode: 0644
notify: __matrix_restart
become: True
become_user: root