blse2-public/package-riot/tasks/main.yml

123 lines
2.9 KiB
YAML

---
- name: install matrix packages
apt:
pkg:
- matrix-synapse
- matrix-synapse-ldap3
- python3-psycopg2
- python3-jinja2
- python3-bleach
- openjdk-8-jre-headless
- mxisd
state: latest
- name: install the rest auth provider
get_url:
url: "https://raw.githubusercontent.com/kamax-matrix/matrix-synapse-rest-auth/master/rest_auth_provider.py"
dest: "/usr/lib/python3/dist-packages/rest_auth_provider.py"
- name: ensure services are started and enabled
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- matrix-synapse
- mxisd
- name: install matrix-synapse configurations
template:
src: "{{ item.src }}.j2"
dest: "{{ item.dest }}"
owner: matrix-synapse
group: adm
mode: 0640
notify: restart matrix-synapse
with_items:
- { src: "matrix-homeserver.yaml", dest: "/etc/matrix-synapse/homeserver.yaml" }
- { src: "matrix-server_name.yaml", dest: "/etc/matrix-synapse/conf.d/server_name.yaml" }
- { src: "matrix-report_stats.yaml", dest: "/etc/matrix-synapse/conf.d/report_stats.yaml" }
- { src: "matrix-homeserver.signing.key", dest: "/etc/matrix-synapse/homeserver.signing.key" }
- name: install mxisd configurations
template:
src: "{{ item.src }}.j2"
dest: "{{ item.dest }}"
owner: mxisd
group: adm
mode: 0640
notify: restart mxisd
with_items:
- { src: "mxisd.yaml", dest: "/etc/mxisd/mxisd.yaml" }
- name: link the res folder to the right place
file:
src: "/usr/lib/python3/dist-packages/synapse/res"
dest: "/var/lib/matrix-synapse/res"
state: link
- name: create matrix data directories
file:
dest: "/srv/matrix/{{ item }}"
state: directory
owner: matrix-synapse
group: sudo
mode: 0750
with_items:
- media
- uploads
- name: install nginx packages
apt:
pkg:
- nginx
state: latest
- name: ensure services are started and enabled
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- nginx
- name: disable default nginx configuration
file:
dest: "/etc/nginx/sites-enabled/default"
state: "absent"
- name: install nginx configuration
template:
src: "riot-nginx.j2"
dest: "/etc/nginx/sites-enabled/riot"
notify: restart nginx
- name: download riot
get_url:
url: "https://github.com/vector-im/riot-web/releases/download/{{ riot_version }}/riot-{{ riot_version }}.tar.gz"
dest: "/var/www/riot.tar.gz"
- name: extract riot
unarchive:
src: "/var/www/riot.tar.gz"
dest: "/var/www"
owner: www-data
group: www-data
copy: no
creates: "/var/www/riot-{{ riot_version }}"
- name: create versionless riot symlink
file:
src: "/var/www/riot-{{ riot_version }}"
dest: "/var/www/riot"
state: link
- name: install riot configuration
template:
src: "riot-config.json.j2"
dest: "/var/www/riot/config.json"
owner: www-data
group: www-data
notify: restart nginx