60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
#!/usr/bin/ansible-playbook
|
|
# vim:ft=ansible:
|
|
---
|
|
- name: Set up Matrix
|
|
block:
|
|
- name: Set up repos
|
|
block:
|
|
- name: Add repo keys
|
|
apt_key:
|
|
url: "{{ item }}"
|
|
loop:
|
|
- "https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg"
|
|
- name: Add repos
|
|
apt_repository:
|
|
repo: "{{ item }}"
|
|
loop:
|
|
- "deb https://packages.matrix.org/debian/ bionic main"
|
|
- name: Install packages
|
|
apt:
|
|
name:
|
|
- "matrix-synapse-py3"
|
|
- name: Set up Apache
|
|
block:
|
|
- name: Enable modules
|
|
command:
|
|
cmd: a2enmod "{{ item }}"
|
|
creates: "/etc/apache2/mods-enabled/{{ item }}.load"
|
|
loop:
|
|
- proxy
|
|
- proxy_http
|
|
notify: restart apache
|
|
- name: Template out vhost
|
|
template:
|
|
src: "apache2-vhost-ssl.conf"
|
|
dest: "/etc/apache2-sites-available/{{ matrix_url }}.conf"
|
|
- name: Create webroot
|
|
file:
|
|
state: directory
|
|
path: "{{ matrix_webroot }}"
|
|
- name: Enable site
|
|
command:
|
|
cmd: "a2ensite {{ matrix_url }}.conf"
|
|
creates: "/etc/apache2/sites-enabled/{{ matrix_url }}.conf"
|
|
notify: restart apache
|
|
- name: Generate certificate
|
|
include_role:
|
|
name: https
|
|
vars:
|
|
website_url: "{{ matrix_url }}"
|
|
- name: Configure Synapse
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: "{{ item.mode }}"
|
|
notify: restart synapse
|
|
loop:
|
|
- { src: "homeserver.yml", dest: "/etc/matrix-synapse/homeserver.yml", "mode: 0644" }
|
|
- { src: "server_name.yml", dest: "/etc/matrix-synapse/conf.d/server_name.yml", "mode: 0644" }
|
|
become: yes
|