Update 2 files

- /roles/matrix/files/homeserver.yaml
- /roles/matrix/tasks/main.yml
This commit is contained in:
Administrator 2025-10-23 08:38:20 +00:00
parent fcc90856ae
commit 300fc1d40f
2 changed files with 24 additions and 15 deletions

View File

@ -1,6 +1,7 @@
server_name: "{{ matrix_server_name }}" server_name: "{{ matrix_server_name }}"
pid_file: /data/homeserver.pid pid_file: /data/homeserver.pid
public_baseurl: "https://{{ matrix_domain }}/" public_baseurl: "https://{{ matrix_domain }}/"
listeners: listeners:
- port: 8008 - port: 8008
tls: false tls: false
@ -23,13 +24,13 @@ database:
log_config: "/data/log.config" log_config: "/data/log.config"
media_store_path: /data/media_store media_store_path: /data/media_store
uploads_path: /data/uploads uploads_path: /data/uploads
enable_registration: {{ matrix_registration_enabled }} enable_registration: {{ matrix_registration_enabled | bool | lower }}
enable_registration_without_verification: false enable_registration_without_verification: false
registration_shared_secret: "{{ matrix_synapse_secret }}" registration_shared_secret: "{{ matrix_synapse_secret }}"
macaroon_secret_key: "{{ matrix_macaroon_secret }}" macaroon_secret_key: "{{ matrix_macaroon_secret }}"
form_secret: "{{ matrix_form_secret }}" form_secret: "{{ matrix_form_secret }}"
report_stats: {{ "true" if matrix_report_stats else "false" }} report_stats: {{ matrix_report_stats | bool | lower }}
retention: retention:
enabled: true enabled: true

View File

@ -14,21 +14,20 @@
- "{{ matrix_postgres_dir }}" - "{{ matrix_postgres_dir }}"
- name: Generate Synapse configuration - name: Generate Synapse configuration
docker_container: command: >
name: matrix-config-generator docker run --rm
image: matrixdotorg/synapse:latest -v {{ matrix_config_dir }}:/data
command: | matrixdotorg/synapse:latest
python -m synapse.app.homeserver \ python -m synapse.app.homeserver
--server-name {{ matrix_server_name }} \ --server-name {{ matrix_server_name }}
--config-path /data/homeserver.yaml \ --config-path /data/homeserver.yaml
--generate-config \ --generate-config
--report-stats={{ "yes" if matrix_report_stats else "no" }} --report-stats={{ "yes" if matrix_report_stats else "no" }}
volumes: args:
- "{{ matrix_config_dir }}:/data" creates: "{{ matrix_config_dir }}/homeserver.yaml"
auto_remove: true
- name: Copy custom configuration files - name: Copy custom configuration files
copy: template:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ matrix_config_dir }}/" dest: "{{ matrix_config_dir }}/"
mode: 0644 mode: 0644
@ -45,6 +44,7 @@
loop: loop:
- "homeserver.yaml" - "homeserver.yaml"
- "log.config" - "log.config"
- "homeserver.yaml.generated" # если файл существует
- name: Deploy Matrix docker-compose.yml - name: Deploy Matrix docker-compose.yml
template: template:
@ -59,6 +59,13 @@
args: args:
executable: /bin/bash executable: /bin/bash
- name: Wait for database to be ready
wait_for:
host: localhost
port: "{{ matrix_port }}"
timeout: 60
delegate_to: localhost
- name: Wait for services to start - name: Wait for services to start
pause: pause:
seconds: 30 seconds: 30
@ -80,6 +87,7 @@
docker exec matrix-synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u admin -p {{ vault_matrix_admin_password }} --admin docker exec matrix-synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u admin -p {{ vault_matrix_admin_password }} --admin
when: matrix_admin_user != "" and matrix_registration_enabled when: matrix_admin_user != "" and matrix_registration_enabled
ignore_errors: true ignore_errors: true
become: no
- name: Show connection info - name: Show connection info
debug: debug: