ansible/roles/synapse/tasks/main.yml
2022-07-22 11:20:26 +02:00

84 lines
1.9 KiB
YAML

---
- name: Setup postgres
include_role:
name: postgre
vars:
postgres_users:
- name: synapse_user
password: "{{ synapse_postgre_user_pwd }}"
databases:
- name: synapse
owner: synapse_user
local: C
template: template0
no_log: "{{ enable_no_log | default('true') }}"
- name: Install apt utils
apt:
name:
- apt-transport-https
- gnupg2
- debconf
- debconf-utils
state: latest
update_cache: true
- name: Install the pgp key for the synapse repo
copy:
src: matrix-org-archive-keyring.gpg
dest: /usr/share/keyrings/matrix-org-archive-keyring.gpg
mode: 0644
- name: Add synapse repo to source list
ansible.builtin.apt_repository:
repo: "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ {{ ansible_facts['lsb']['codename'] }} main"
state: present
- name: Configure debian question for hostname
debconf:
name: matrix-synapse-py3
question: matrix-synapse/server-name
value: "{{ matrix_server_name }}"
vtype: string
- name: Install synapse
apt:
name:
- matrix-synapse-py3
state: latest
update_cache: true
- name: Configure synapse
template:
src: homeserver.yaml
dest: /etc/matrix-synapse/homeserver.yaml
notify: Restart synapse
no_log: "{{ enable_no_log | default('true') }}"
# --- DRAFT ---
- name: Install nginx
apt:
name: nginx
state: latest
update_cache: true
- name: Generate self signed cert
include_role:
name: generate_self_signed_certificate
vars:
server_hostname: "{{ matrix_local_server_name }}"
- name: Copy reverse proxy sites
template:
src: nginx/config_synapse
dest: /etc/nginx/sites-available/synapse
notify: Reload nginx
- name: Activate sites
file:
src: "/etc/nginx/sites-available/synapse"
dest: "/etc/nginx/sites-enabled/synapse"
state: link
force: yes
notify: Reload nginx