Ansible roles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
3.4 KiB

---
- name: Install system dependencies
yum:
name:
- libtiff-devel
- libjpeg-devel
- libzip-devel
- freetype-devel
- lcms2-devel
- libwebp-devel
- tcl-devel
- tk-devel
- libffi-devel
- openssl-devel
- libxslt-devel
- gcc
- gcc-c++
- libtool
- autoconf
- automake
- postgresql11
- postgresql-devel
- libpqxx-devel
- jemalloc
- rh-python36-python-virtualenv
- rh-python36-python-pip
tags: matrix
- name: Stop synapse
service: name=matrix-synapse state=stopped
when: synapse_venv_27.stat.exists
tags: matrix
- name: Remove the venv
file: path={{ synapse_root_dir }}/{{ item }} state=absent
loop:
- lib
- lib64
- include
- bin
when: synapse_venv_27.stat.exists
tags: matrix
- name: Install or update dependencies in the virtual env
pip:
state: latest
virtualenv: "{{ synapse_root_dir }}"
virtualenv_command: /opt/rh/rh-python36/root/usr/bin/virtualenv
name:
- bleach
- matrix-synapse-ldap3
- psycopg2
- txacme
- Jinja2
- lxml
- pysaml2
- mock
- six
notify: restart synapse
tags: matrix
- name: Install or update synapse in a virtualenv
pip:
virtualenv: "{{ synapse_root_dir }}"
virtualenv_command: /opt/rh/rh-python36/root/usr/bin/virtualenv
name:
- matrix-synapse
version: "{{ synapse_version }}"
notify: restart synapse
tags: matrix
- name: Install the service unit file
template: src=matrix-synapse.service.j2 dest=/etc/systemd/system/matrix-synapse.service
register: synapse_service_unit
tags: matrix
- name: Reload systemd
systemd: daemon_reload=True
when: synapse_service_unit.changed
tags: matrix
- name: Install REST auth module
get_url:
url: https://raw.githubusercontent.com/ma1uta/matrix-synapse-rest-password-provider/master/rest_auth_provider.py
dest: "{{ synapse_root_dir }}/lib/python3.6/site-packages/"
tags: matrix
- name: Create the PostgreSQL role
postgresql_user:
db: postgres
name: "{{ synapse_pg_db_user }}"
password: "{{ synapse_pg_db_pass }}"
login_host: "{{ synapse_pg_db_server }}"
login_user: sqladmin
login_password: "{{ pg_admin_pass }}"
tags: matrix
- name: Create the PostgreSQL database
postgresql_db:
name: "{{ synapse_pg_db_name }}"
encoding: UTF-8
lc_collate: C
lc_ctype: C
template: template0
owner: "{{ synapse_pg_db_user }}"
login_host: "{{ synapse_pg_db_server }}"
login_user: sqladmin
login_password: "{{ pg_admin_pass }}"
tags: matrix
- name: Deploy backup scripts
template: src={{ item.src }} dest=/etc/backup/{{ item.dest }}/matrix_synapse.sh mode=750
with_items:
- src: pre-backup.sh.j2
dest: pre.d
- src: post-backup.sh.j2
dest: post.d
tags: matrix
- name: Install synapse_janitor.sql script
get_url:
url: https://raw.githubusercontent.com/xwiki-labs/synapse_scripts/master/synapse_janitor.sql
dest: "{{ synapse_root_dir }}/res/"
tags: matrix
- name: Deploy janitor script
template: src=synapse_janitor.sh.j2 dest={{ synapse_root_dir }}/bin/synapse_janitor.sh mode=700
tags: matrix
- name: Setup cron job to clean synapse database
cron:
name: matrix_synapse_janitor
special_time: weekly
user: root
job: '{{ synapse_root_dir }}/bin/synapse_janitor.sh | /bin/systemd-cat'
cron_file: matrix_synapse
tags: matrix