ansible/roles/synapse/tasks/main.yml

94 lines
2.1 KiB
YAML
Raw Permalink Normal View History

2021-07-27 03:34:14 +02:00
---
- name: Setup postgres
include_role:
name: postgre
vars:
postgres_users:
- name: synapse_user
2021-07-28 01:42:43 +02:00
password: "{{ synapse_postgre_user_pwd }}"
databases:
- name: synapse
owner: synapse_user
local: C
template: template0
2021-08-06 05:54:20 +02:00
no_log: true
2021-07-27 23:35:04 +02:00
- name: Install apt utils
2021-07-27 03:34:14 +02:00
apt:
name:
- apt-transport-https
2021-07-27 23:35:04 +02:00
- gnupg2
- debconf
- debconf-utils
2021-07-27 03:34:14 +02:00
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- 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
2021-07-27 23:35:04 +02:00
- name: Configure debian question for hostname
debconf:
name: matrix-synapse-py3
question: matrix-synapse/server-name
value: "{{ matrix_server_name }}"
vtype: string
2021-07-27 03:34:14 +02:00
- name: Install synapse
apt:
name:
- matrix-synapse-py3
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
2021-07-28 02:22:54 +02:00
2021-07-28 02:29:19 +02:00
- name: Configure synapse
template:
src: homeserver.yaml
dest: /etc/matrix-synapse/homeserver.yaml
2021-08-06 03:28:11 +02:00
notify: Restart synapse
2021-08-06 05:54:20 +02:00
no_log: true
2021-07-28 02:22:54 +02:00
# --- DRAFT ---
- name: Install nginx
apt:
name: nginx
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Generate self signed cert
include_role:
name: generate_self_signed_certificate
vars:
2021-08-02 03:49:36 +02:00
server_hostname: "{{ matrix_local_server_name }}"
2021-07-28 02:22:54 +02:00
- name: Copy reverse proxy sites
template:
2021-07-28 02:29:19 +02:00
src: nginx/config_synapse
dest: /etc/nginx/sites-available/synapse
2021-07-28 02:22:54 +02:00
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