Update slack bridge implementation
This commit is contained in:
parent
d07480a883
commit
2e0dfb2dc1
|
@ -53,6 +53,8 @@ matrix_homeserver_container_extra_arguments_auto: |
|
|||
+
|
||||
(['--mount type=bind,src=' + matrix_mautrix_discord_config_path + '/registration.yaml,dst=/matrix-mautrix-discord-registration.yaml,ro'] if matrix_mautrix_discord_enabled else [])
|
||||
+
|
||||
(['--mount type=bind,src=' + matrix_mautrix_slack_config_path + '/registration.yaml,dst=/matrix-mautrix-slack-registration.yaml,ro'] if matrix_mautrix_slack_enabled else [])
|
||||
+
|
||||
(['--mount type=bind,src=' + matrix_mautrix_facebook_config_path + '/registration.yaml,dst=/matrix-mautrix-facebook-registration.yaml,ro'] if matrix_mautrix_facebook_enabled else [])
|
||||
+
|
||||
(['--mount type=bind,src=' + matrix_mautrix_googlechat_config_path + '/registration.yaml,dst=/matrix-mautrix-googlechat-registration.yaml,ro'] if matrix_mautrix_googlechat_enabled else [])
|
||||
|
@ -108,6 +110,8 @@ matrix_homeserver_app_service_config_files_auto: |
|
|||
+
|
||||
(['/matrix-mautrix-discord-registration.yaml'] if matrix_mautrix_discord_enabled else [])
|
||||
+
|
||||
(['/matrix-mautrix-slack-registration.yaml'] if matrix_mautrix_slack_enabled else [])
|
||||
+
|
||||
(['/matrix-mautrix-facebook-registration.yaml'] if matrix_mautrix_facebook_enabled else [])
|
||||
+
|
||||
(['/matrix-mautrix-googlechat-registration.yaml'] if matrix_mautrix_googlechat_enabled else [])
|
||||
|
@ -209,6 +213,8 @@ devture_systemd_service_manager_services_list_auto: |
|
|||
+
|
||||
([{'name': 'matrix-mautrix-discord.service', 'priority': 2000, 'groups': ['matrix', 'bridges', 'mautrix-discord']}] if matrix_mautrix_discord_enabled else [])
|
||||
+
|
||||
([{'name': 'matrix-mautrix-slack.service', 'priority': 2000, 'groups': ['matrix', 'bridges', 'mautrix-slack']}] if matrix_mautrix_slack_enabled else [])
|
||||
+
|
||||
([{'name': 'matrix-mautrix-facebook.service', 'priority': 2000, 'groups': ['matrix', 'bridges', 'mautrix-facebook']}] if matrix_mautrix_facebook_enabled else [])
|
||||
+
|
||||
([{'name': 'matrix-mautrix-googlechat.service', 'priority': 2000, 'groups': ['matrix', 'bridges', 'mautrix-googlechat']}] if matrix_mautrix_googlechat_enabled else [])
|
||||
|
@ -725,6 +731,46 @@ matrix_mautrix_discord_database_password: "{{ '%s' | format(matrix_homeserver_ge
|
|||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-bridge-mautrix-slack
|
||||
#
|
||||
######################################################################
|
||||
|
||||
# We don't enable bridges by default.
|
||||
matrix_mautrix_slack_enabled: false
|
||||
|
||||
matrix_mautrix_slack_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}"
|
||||
|
||||
matrix_mautrix_slack_systemd_required_services_list: |
|
||||
{{
|
||||
['docker.service']
|
||||
+
|
||||
['matrix-' + matrix_homeserver_implementation + '.service']
|
||||
+
|
||||
([devture_postgres_identifier ~ '.service'] if devture_postgres_enabled else [])
|
||||
+
|
||||
(['matrix-nginx-proxy.service'] if matrix_nginx_proxy_enabled else [])
|
||||
}}
|
||||
|
||||
matrix_mautrix_slack_appservice_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'mauslack.as.tok', rounds=655555) | to_uuid }}"
|
||||
|
||||
matrix_mautrix_slack_homeserver_token: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'mauslack.hs.tok', rounds=655555) | to_uuid }}"
|
||||
|
||||
matrix_mautrix_slack_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
|
||||
|
||||
# Postgres is the default, except if not using internal Postgres server
|
||||
matrix_mautrix_slack_database_engine: "{{ 'postgres' if devture_postgres_enabled else 'sqlite' }}"
|
||||
matrix_mautrix_slack_database_hostname: "{{ devture_postgres_connection_hostname if devture_postgres_enabled else '' }}"
|
||||
matrix_mautrix_slack_database_password: "{{ '%s' | format(matrix_homeserver_generic_secret_key) | password_hash('sha512', 'mauslack.db', rounds=655555) | to_uuid }}"
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# /matrix-bridge-mautrix-slack
|
||||
#
|
||||
######################################################################
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# matrix-bridge-mautrix-facebook
|
||||
|
@ -2448,7 +2494,7 @@ devture_postgres_managed_databases_auto: |
|
|||
'name': matrix_mautrix_slack_database_name,
|
||||
'username': matrix_mautrix_slack_database_username,
|
||||
'password': matrix_mautrix_slack_database_password,
|
||||
}] if (matrix_mautrix_slack_enabled and matrix_mautrix_slack_database_engine == 'postgres' and matrix_mautrix_slack_database_hostname == 'matrix-postgres') else [])
|
||||
}] if (matrix_mautrix_slack_enabled and matrix_mautrix_slack_database_engine == 'postgres' and matrix_mautrix_slack_database_hostname == devture_postgres_connection_hostname) else [])
|
||||
+
|
||||
([{
|
||||
'name': matrix_mx_puppet_slack_database_name,
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
---
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-slack.service'] }}"
|
||||
when: matrix_mautrix_slack_enabled | bool
|
||||
|
||||
# If the matrix-synapse role is not used, these variables may not exist.
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_homeserver_container_runtime_injected_arguments: >
|
||||
{{
|
||||
matrix_homeserver_container_runtime_injected_arguments | default([])
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_mautrix_slack_config_path }}/registration.yaml,dst=/matrix-mautrix-slack-registration.yaml,ro"]
|
||||
}}
|
||||
|
||||
matrix_homeserver_app_service_runtime_injected_config_files: >
|
||||
{{
|
||||
matrix_homeserver_app_service_runtime_injected_config_files | default([])
|
||||
+
|
||||
["/matrix-mautrix-slack-registration.yaml"]
|
||||
}}
|
||||
when: matrix_mautrix_slack_enabled | bool
|
|
@ -1,22 +1,20 @@
|
|||
---
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_mautrix_slack_enabled | bool"
|
||||
- block:
|
||||
- when: matrix_mautrix_slack_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
|
||||
- when: matrix_mautrix_slack_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-slack
|
||||
- install-all
|
||||
- install-mautrix-slack
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup and matrix_mautrix_slack_enabled"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-slack
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup and not matrix_mautrix_slack_enabled"
|
||||
- block:
|
||||
- when: not matrix_mautrix_slack_enabled | bool
|
||||
ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-mautrix-slack
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
---
|
||||
|
||||
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
|
||||
# We don't want to fail in such cases.
|
||||
- name: Fail if matrix-synapse role already executed
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
The matrix-bridge-mautrix-slack role needs to execute before the matrix-synapse role.
|
||||
when: "matrix_synapse_role_executed | default(False)"
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_mautrix_slack_requires_restart: false
|
||||
|
||||
|
@ -20,8 +12,11 @@
|
|||
|
||||
- when: "matrix_mautrix_slack_sqlite_database_path_local_stat_result.stat.exists | bool"
|
||||
block:
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
- ansible.builtin.include_role:
|
||||
name: galaxy/com.devture.ansible.role.postgres
|
||||
tasks_from: migrate_db_to_postgres
|
||||
vars:
|
||||
devture_postgres_db_migration_request:
|
||||
src: "{{ matrix_mautrix_slack_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_mautrix_slack_database_connection_string }}"
|
||||
caller: "{{ role_path | basename }}"
|
||||
|
@ -30,10 +25,6 @@
|
|||
systemd_services_to_stop: ['matrix-mautrix-slack.service']
|
||||
pgloader_options: ['--with "quote identifiers"']
|
||||
|
||||
- ansible.builtin.import_role:
|
||||
name: custom/matrix-postgres
|
||||
tasks_from: migrate_db_to_postgres
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_mautrix_slack_requires_restart: true
|
||||
|
||||
|
@ -109,13 +100,9 @@
|
|||
mode: 0644
|
||||
register: matrix_mautrix_slack_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-mautrix-slack.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_mautrix_slack_systemd_service_result.changed"
|
||||
|
||||
- name: Ensure matrix-mautrix-slack.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-mautrix-slack.service"
|
||||
state: restarted
|
||||
daemon_reload: true
|
||||
when: "matrix_mautrix_slack_requires_restart | bool"
|
||||
|
|
|
@ -5,21 +5,16 @@
|
|||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mautrix-slack.service"
|
||||
register: matrix_mautrix_slack_service_stat
|
||||
|
||||
- name: Ensure matrix-mautrix-slack is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-mautrix-slack
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
when: "matrix_mautrix_slack_service_stat.stat.exists"
|
||||
- when: matrix_mautrix_slack_service_stat.stat.exists | bool
|
||||
block:
|
||||
- name: Ensure matrix-mautrix-slack is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-mautrix-slack
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
|
||||
- name: Ensure matrix-mautrix-slack.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mautrix-slack.service"
|
||||
state: absent
|
||||
when: "matrix_mautrix_slack_service_stat.stat.exists"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-mautrix-slack.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_mautrix_slack_service_stat.stat.exists"
|
||||
- name: Ensure matrix-mautrix-slack.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mautrix-slack.service"
|
||||
state: absent
|
||||
|
|
Loading…
Reference in a new issue