original templated files
This commit is contained in:
69
roles/matrix-synapse/tasks/main.yml
Normal file
69
roles/matrix-synapse/tasks/main.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
- name: Generate signing key (if missing)
|
||||
command: >
|
||||
podman run --rm -v "{{ synapse_data_dir }}:/data"
|
||||
ghcr.io/element-hq/synapse:latest
|
||||
generate-config --server-name "{{ matrix_domain }}"
|
||||
--report-stats no
|
||||
-o /data/homeserver.yaml
|
||||
args:
|
||||
creates: "{{ synapse_data_dir }}/homeserver.yaml"
|
||||
|
||||
- name: Copy homeserver.yaml (configured)
|
||||
template:
|
||||
src: synapse/homeserver.yaml.j2
|
||||
dest: "{{ synapse_data_dir }}/homeserver.yaml"
|
||||
owner: "{{ podman_user }}"
|
||||
group: "{{ podman_user }}"
|
||||
mode: '0644'
|
||||
|
||||
- name: Ensure PostgreSQL database exists
|
||||
become_user: postgres
|
||||
community.postgresql.postgresql_db:
|
||||
name: "{{ db_name }}"
|
||||
state: present
|
||||
delegate_to: "{{ inventory_hostname }}" # assuming DB on same host
|
||||
|
||||
- name: Ensure PostgreSQL user exists
|
||||
become_user: postgres
|
||||
community.postgresql.postgresql_user:
|
||||
name: "{{ db_user }}"
|
||||
password: "{{ db_pass }}"
|
||||
priv: "{{ db_name }}.*:ALL"
|
||||
state: present
|
||||
delegate_to: "{{ inventory_hostname }}"
|
||||
|
||||
- name: Create Podman pod
|
||||
command: >
|
||||
podman pod create
|
||||
--name {{ podman_pod_name }}
|
||||
--publish 8008:8008 # synapse
|
||||
--publish 8448:8448 # federation
|
||||
when: podman_user != "root"
|
||||
changed_when: false
|
||||
|
||||
- name: Run PostgreSQL container
|
||||
container:
|
||||
name: synapse-db
|
||||
image: docker.io/library/postgres:15-alpine
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
pod: "{{ podman_pod_name }}"
|
||||
env:
|
||||
POSTGRES_DB: "{{ db_name }}"
|
||||
POSTGRES_USER: "{{ db_user }}"
|
||||
POSTGRES_PASSWORD: "{{ db_pass }}"
|
||||
volumes:
|
||||
- "{{ synapse_data_dir }}/db:/var/lib/postgresql/data"
|
||||
register: pg_cont
|
||||
|
||||
- name: Run Synapse container
|
||||
container:
|
||||
name: synapse
|
||||
image: ghcr.io/element-hq/synapse:latest
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
pod: "{{ podman_pod_name }}"
|
||||
volumes:
|
||||
- "{{ synapse_data_dir }}:/data"
|
||||
command: >
|
||||
-c /data/homeserver.yaml
|
||||
37
roles/matrix-synapse/templates/homeserver.yaml.j2
Normal file
37
roles/matrix-synapse/templates/homeserver.yaml.j2
Normal file
@@ -0,0 +1,37 @@
|
||||
server_name: "{{ matrix_domain }}"
|
||||
enable_metrics: false
|
||||
report_stats: false
|
||||
|
||||
listeners:
|
||||
- port: 8008
|
||||
type: http
|
||||
tls: false
|
||||
resources:
|
||||
- names: [client, federation]
|
||||
compress: true
|
||||
|
||||
database:
|
||||
name: psycopg2
|
||||
args:
|
||||
user: "{{ db_user }}"
|
||||
password: "{{ db_pass }}"
|
||||
database: "{{ db_name }}"
|
||||
host: "localhost"
|
||||
port: 5432
|
||||
|
||||
registration_shared_secret: "{{ synapse_registration_secret }}"
|
||||
tls_certificate_path: "/data/tls.crt"
|
||||
private_key_path: "/data/tls.key"
|
||||
|
||||
federation_domain_whitelist:
|
||||
- matrix.org
|
||||
- gitter.im
|
||||
|
||||
# Optional: Rate limits
|
||||
rc_flood_control:
|
||||
interval: 1000
|
||||
burst_count: 3
|
||||
|
||||
# Enable password login
|
||||
enable_registration: true
|
||||
enable_registration_without_verification: true
|
||||
Reference in New Issue
Block a user