xoxys.matrix/tasks/install.yml

91 lines
2.7 KiB
YAML
Raw Normal View History

2019-01-18 13:52:23 +00: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 00:30:45 +00:00
- "{{ matrix_data_dir }}"
2019-01-19 14:09:07 +00:00
- "{{ matrix_log_dir }}"
2019-01-18 13:52:23 +00:00
become: True
become_user: root
- block:
- name: Upgrade python dependencies
pip:
name: "{{ item }}"
2019-01-24 19:51:11 +00:00
virtualenv: "{{ matrix_base_dir }}/env"
2019-01-19 00:30:45 +00:00
virtualenv_command: /usr/bin/python3 -m venv
2019-01-18 13:52:23 +00:00
extra_args: --upgrade
loop:
- pip
- setuptools
2019-05-19 13:12:16 +00:00
- "psycopg2~=2.7.0"
2019-01-18 13:52:23 +00:00
- name: Install with pip and virtualenv
pip:
2019-01-19 00:30:45 +00:00
name: matrix-synapse[all]
2019-01-18 13:52:23 +00:00
version: "{{ matrix_version }}"
virtualenv: "{{ matrix_base_dir }}/env"
2019-01-19 00:30:45 +00:00
virtualenv_command: /usr/bin/python3 -m venv
2019-02-05 22:02:27 +00:00
notify: __matrix_restart
2019-01-18 13:52:23 +00:00
2019-01-19 21:02:52 +00:00
- name: Install ldap3 auth provider
pip:
name: "matrix-synapse-ldap3"
virtualenv: "{{ matrix_base_dir }}/env"
virtualenv_command: /usr/bin/python3 -m venv
2019-06-10 12:06:34 +00:00
when: matrix_ldap_auth_enabled | bool
2019-01-19 21:02:52 +00:00
2019-01-19 14:06:56 +00:00
- name: Create signing key
2019-01-20 14:02:02 +00:00
shell: "{{ matrix_base_dir }}/env/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 14:06:56 +00:00
args:
2019-01-20 14:02:02 +00:00
creates: "{{ matrix_conf_dir }}/{{ matrix_server_url }}.signing.key"
2019-01-19 14:06:56 +00:00
notify: __matrix_restart
- name: Deploy global config files
2019-01-18 13:52:23 +00:00
template:
2019-01-19 14:06:56 +00:00
src: "opt/matrix/config/{{ item }}.j2"
dest: "{{ matrix_conf_dir }}/{{ item }}"
mode: 0600
2019-01-19 14:06:56 +00:00
loop:
- "homeserver.yml"
2019-01-19 14:22:55 +00:00
- "logging.config"
2019-01-18 13:52:23 +00:00
notify: __matrix_restart
become: True
become_user: "{{ matrix_user }}"
- block:
- name: Copy systemd unit file
template:
src: "etc/systemd/system/matrix.service.j2"
dest: "/etc/systemd/system/matrix.service"
notify: __matrix_restart
- name: Copy logrotate config
template:
src: "etc/logrotate.d/config.j2"
dest: "/etc/logrotate.d/matrix"
loop: "{{ matrix_logrotate_config }}"
2019-01-30 21:42:30 +00:00
loop_control:
label: "{{ item.log }}"
2019-06-10 12:06:34 +00:00
when: matrix_logrotate_enabled | bool
2019-01-18 13:52:23 +00:00
- name: Open ports in iptables
iptables_raw:
name: "{{ item.name }}"
rules: "{{ item.rules }}"
2019-07-27 09:49:11 +00:00
state: "{{ item.state | default('present') }}"
2019-01-18 13:52:23 +00:00
weight: "{{ item.weight | default(omit) }}"
table: "{{ item.table | default(omit) }}"
loop: "{{ matrix_open_ports }}"
2019-01-18 13:52:23 +00:00
loop_control:
label: "{{ item.name }}"
2019-06-10 12:06:34 +00:00
when: matrix_iptables_enabled | bool
2019-01-18 13:52:23 +00:00
become: True
become_user: root