automation/deployer/roles/build/tasks/synapse.yml

94 lines
2.7 KiB
YAML
Raw Normal View History

2020-05-23 09:22:41 +00:00
---
- block: # Used for tagging all tasks with "synapse"
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
set_fact: site_data_path="{{ www_path }}/{{ site.slug }}"
2020-10-18 17:27:13 +00:00
tags: always
####################
# Render templates #
####################
- name: "Render templates"
import_tasks: render.yml
tags: render
##########################
# Generate configuration #
##########################
- block: # Used for tagging all tasks with "config"
- name: "Create folder {{ site_data_path }}"
file:
path: "{{ site_data_path }}"
state: directory
mode: "770"
group: "www-data"
- name: "Copy homeserver.yaml to {{ site_data_path }}"
copy:
src: "{{ sites_path }}/{{ site.slug }}/homeserver.yaml"
dest: "{{ site_data_path }}/homeserver.yaml"
remote_src: yes
- name: "Let synapse generate missing configuration files"
docker_container:
name: synapse_config_generator
image: "matrixdotorg/synapse:{{ synapse.version }}"
command: "generate"
volumes:
- "{{ site_data_path }}:/data"
env:
SYNAPSE_SERVER_NAME: "{{ site.url }}"
SYNAPSE_REPORT_STATS: "no"
UID: "{{ site.user_uid }}"
GID: "{{ site.user_gid }}"
tags: config
############################
# PostgreSQL configuration #
############################
- name: "Setup PostgreSQL"
import_tasks: postgres.yml
tags: postgres
2021-01-17 20:22:35 +00:00
###########################################
# Allow coturn inbound connections in UFW #
###########################################
- name: "Allow inbound port {{ site.coturn.listening_port }} for coturn in UFW"
ufw:
direction: in
from_ip: any
to_port: "{{ site.coturn.listening_port }}"
2021-01-17 20:22:35 +00:00
proto: any
rule: allow
comment: "coturn TCP/UDP"
become: true
tags: firewall
2021-01-17 20:22:35 +00:00
- name: "Allow inbound ports {{ site.coturn.min_port }}-{{ site.coturn.max_port }}/UDP for coturn un UFW"
2021-01-17 20:22:35 +00:00
ufw:
direction: in
from_ip: any
to_port: "{{ item }}"
2021-01-19 13:25:15 +00:00
proto: udp
rule: allow
comment: "coturn UDP"
with_sequence: start="{{ site.coturn.min_port }}" end="{{ site.coturn.max_port }}"
#loop: "{{ range({{ site.coturn.min_port }}, {{ site.coturn.max_port }} + 1)|list }}"
become: true
tags: firewall
2021-01-17 20:22:35 +00:00
#################
# Setup backups #
#################
- name: "Setup backups"
import_tasks: backup.yml
tags: backup
tags: synapse # / block