Rename matrix_wechat_* variables to matrix_bridge_wechat_*

Part of adopting a uniform naming policy for bridge variables,
where the variable prefix matches the role directory name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Slavi Pantaleev
2026-07-16 15:01:57 +03:00
parent 129f5fda20
commit e3faabf125
11 changed files with 223 additions and 223 deletions
+3 -3
View File
@@ -19,7 +19,7 @@ See the project's [documentation](https://github.com/duo/matrix-wechat/blob/mast
To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file:
```yaml ```yaml
matrix_wechat_enabled: true matrix_bridge_wechat_enabled: true
``` ```
### Extending the configuration ### Extending the configuration
@@ -29,7 +29,7 @@ There are some additional things you may wish to configure about the bridge.
Take a look at: Take a look at:
- `roles/custom/matrix-bridge-wechat/defaults/main.yml` for some variables that you can customize via your `vars.yml` file - `roles/custom/matrix-bridge-wechat/defaults/main.yml` for some variables that you can customize via your `vars.yml` file
- `roles/custom/matrix-bridge-wechat/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_wechat_configuration_extension_yaml` variable - `roles/custom/matrix-bridge-wechat/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_bridge_wechat_configuration_extension_yaml` variable
## Installing ## Installing
@@ -62,5 +62,5 @@ The default logging level for this component is `warn`. If you want to increase
```yaml ```yaml
# Valid values: fatal, error, warn, info, debug # Valid values: fatal, error, warn, info, debug
matrix_wechat_log_level: 'debug' matrix_bridge_wechat_log_level: 'debug'
``` ```
+31 -31
View File
@@ -104,7 +104,7 @@ matrix_homeserver_container_extra_arguments_auto: |
+ +
(['--mount type=bind,src=' + matrix_bridge_beeper_linkedin_config_path + '/registration.yaml,dst=/matrix-beeper-linkedin-registration.yaml,ro'] if matrix_bridge_beeper_linkedin_enabled else []) (['--mount type=bind,src=' + matrix_bridge_beeper_linkedin_config_path + '/registration.yaml,dst=/matrix-beeper-linkedin-registration.yaml,ro'] if matrix_bridge_beeper_linkedin_enabled else [])
+ +
(['--mount type=bind,src=' + matrix_wechat_config_path + '/registration.yaml,dst=/matrix-wechat-registration.yaml,ro'] if matrix_wechat_enabled else []) (['--mount type=bind,src=' + matrix_bridge_wechat_config_path + '/registration.yaml,dst=/matrix-wechat-registration.yaml,ro'] if matrix_bridge_wechat_enabled else [])
+ +
(['--mount type=bind,src=' + matrix_bridge_heisenbridge_base_path + '/registration.yaml,dst=/heisenbridge-registration.yaml,ro'] if matrix_bridge_heisenbridge_enabled else []) (['--mount type=bind,src=' + matrix_bridge_heisenbridge_base_path + '/registration.yaml,dst=/heisenbridge-registration.yaml,ro'] if matrix_bridge_heisenbridge_enabled else [])
+ +
@@ -163,7 +163,7 @@ matrix_homeserver_app_service_config_files_auto: |
+ +
(['/matrix-beeper-linkedin-registration.yaml'] if matrix_bridge_beeper_linkedin_enabled else []) (['/matrix-beeper-linkedin-registration.yaml'] if matrix_bridge_beeper_linkedin_enabled else [])
+ +
(['/matrix-wechat-registration.yaml'] if matrix_wechat_enabled else []) (['/matrix-wechat-registration.yaml'] if matrix_bridge_wechat_enabled else [])
+ +
(['/heisenbridge-registration.yaml'] if matrix_bridge_heisenbridge_enabled else []) (['/heisenbridge-registration.yaml'] if matrix_bridge_heisenbridge_enabled else [])
+ +
@@ -380,16 +380,16 @@ devture_systemd_service_manager_services_list_auto: |
([{ ([{
'name': 'matrix-wechat.service', 'name': 'matrix-wechat.service',
'priority': 2000, 'priority': 2000,
'restart_necessary': (matrix_wechat_restart_necessary | bool), 'restart_necessary': (matrix_bridge_wechat_restart_necessary | bool),
'groups': ['matrix', 'bridges', 'wechat'], 'groups': ['matrix', 'bridges', 'wechat'],
}] if matrix_wechat_enabled else []) }] if matrix_bridge_wechat_enabled else [])
+ +
([{ ([{
'name': 'matrix-wechat-agent.service', 'name': 'matrix-wechat-agent.service',
'priority': 2000, 'priority': 2000,
'restart_necessary': (matrix_wechat_restart_necessary | bool), 'restart_necessary': (matrix_bridge_wechat_restart_necessary | bool),
'groups': ['matrix', 'bridges', 'wechat'], 'groups': ['matrix', 'bridges', 'wechat'],
}] if matrix_wechat_enabled else []) }] if matrix_bridge_wechat_enabled else [])
+ +
([{ ([{
'name': 'matrix-heisenbridge.service', 'name': 'matrix-heisenbridge.service',
@@ -2349,49 +2349,49 @@ matrix_bridge_mautrix_wsproxy_syncproxy_database_password: "{{ (matrix_homeserve
###################################################################### ######################################################################
# We don't enable bridges by default. # We don't enable bridges by default.
matrix_wechat_enabled: false matrix_bridge_wechat_enabled: false
matrix_wechat_systemd_required_services_list_auto: | matrix_bridge_wechat_systemd_required_services_list_auto: |
{{ {{
matrix_addons_homeserver_systemd_services_list matrix_addons_homeserver_systemd_services_list
+ +
([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_wechat_database_hostname == postgres_connection_hostname) else []) ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_bridge_wechat_database_hostname == postgres_connection_hostname) else [])
}} }}
matrix_wechat_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_wechat_container_image_registry_prefix_upstream_default }}" matrix_bridge_wechat_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bridge_wechat_container_image_registry_prefix_upstream_default }}"
matrix_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_wechat_agent_container_image_registry_prefix_upstream_default }}" matrix_bridge_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default }}"
matrix_wechat_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}" matrix_bridge_wechat_container_image_self_build: "{{ matrix_architecture not in ['amd64', 'arm64'] }}"
matrix_wechat_agent_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}" matrix_bridge_wechat_agent_container_image_self_build: "{{ matrix_architecture not in ['amd64'] }}"
matrix_wechat_container_network: "{{ matrix_addons_container_network }}" matrix_bridge_wechat_container_network: "{{ matrix_addons_container_network }}"
matrix_wechat_container_additional_networks_auto: |- matrix_bridge_wechat_container_additional_networks_auto: |-
{{ {{
( (
([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network])
+ +
([postgres_container_network] if (postgres_enabled and matrix_wechat_database_hostname == postgres_connection_hostname and matrix_wechat_container_network != postgres_container_network) else []) ([postgres_container_network] if (postgres_enabled and matrix_bridge_wechat_database_hostname == postgres_connection_hostname and matrix_bridge_wechat_container_network != postgres_container_network) else [])
) | unique ) | unique
}} }}
matrix_wechat_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.as.token') | hash('sha512') | to_uuid }}" matrix_bridge_wechat_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.as.token') | hash('sha512') | to_uuid }}"
matrix_wechat_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}" matrix_bridge_wechat_homeserver_address: "{{ matrix_addons_homeserver_client_api_url }}"
matrix_wechat_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.hs.token') | hash('sha512') | to_uuid }}" matrix_bridge_wechat_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':wechat.hs.token') | hash('sha512') | to_uuid }}"
matrix_wechat_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}" matrix_bridge_wechat_homeserver_async_media: "{{ matrix_homeserver_implementation in ['synapse'] }}"
matrix_wechat_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}" matrix_bridge_wechat_login_shared_secret: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret if matrix_synapse_ext_password_provider_shared_secret_auth_enabled else '' }}"
matrix_wechat_bridge_listen_secret: "{{ (matrix_homeserver_generic_secret_key + ':wechat.lstn') | hash('sha512') | to_uuid }}" matrix_bridge_wechat_bridge_listen_secret: "{{ (matrix_homeserver_generic_secret_key + ':wechat.lstn') | hash('sha512') | to_uuid }}"
# Postgres is the default, except if not using internal Postgres server # Postgres is the default, except if not using internal Postgres server
matrix_wechat_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}" matrix_bridge_wechat_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}"
matrix_wechat_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" matrix_bridge_wechat_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}"
matrix_wechat_database_password: "{{ (matrix_homeserver_generic_secret_key + ':gowechat.db') | hash('sha512') | to_uuid }}" matrix_bridge_wechat_database_password: "{{ (matrix_homeserver_generic_secret_key + ':gowechat.db') | hash('sha512') | to_uuid }}"
###################################################################### ######################################################################
# #
@@ -4165,10 +4165,10 @@ postgres_managed_databases_auto: |
}] if (matrix_bridge_beeper_linkedin_enabled and matrix_bridge_beeper_linkedin_database_engine == 'postgres' and matrix_bridge_beeper_linkedin_database_hostname == postgres_connection_hostname) else []) }] if (matrix_bridge_beeper_linkedin_enabled and matrix_bridge_beeper_linkedin_database_engine == 'postgres' and matrix_bridge_beeper_linkedin_database_hostname == postgres_connection_hostname) else [])
+ +
([{ ([{
'name': matrix_wechat_database_name, 'name': matrix_bridge_wechat_database_name,
'username': matrix_wechat_database_username, 'username': matrix_bridge_wechat_database_username,
'password': matrix_wechat_database_password, 'password': matrix_bridge_wechat_database_password,
}] if (matrix_wechat_enabled and matrix_wechat_database_engine == 'postgres' and matrix_wechat_database_hostname == postgres_connection_hostname) else []) }] if (matrix_bridge_wechat_enabled and matrix_bridge_wechat_database_engine == 'postgres' and matrix_bridge_wechat_database_hostname == postgres_connection_hostname) else [])
+ +
([{ ([{
'name': matrix_bridge_mautrix_bluesky_database_name, 'name': matrix_bridge_mautrix_bluesky_database_name,
@@ -5204,9 +5204,9 @@ matrix_ketesa_config_asManagedUsers_auto: |
] if matrix_bridge_sms_enabled else []) ] if matrix_bridge_sms_enabled else [])
+ +
([ ([
'^@'+(matrix_wechat_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', '^@'+(matrix_bridge_wechat_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$',
'^@_wechat_[a-zA-Z0-9]+:'+(matrix_domain | regex_escape)+'$', '^@_wechat_[a-zA-Z0-9]+:'+(matrix_domain | regex_escape)+'$',
] if matrix_wechat_enabled else []) ] if matrix_bridge_wechat_enabled else [])
+ +
([ ([
'^@'+(matrix_bridge_steam_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', '^@'+(matrix_bridge_steam_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$',
@@ -8,161 +8,161 @@
# WeChat Bridge is a Matrix <-> WeChat bridge # WeChat Bridge is a Matrix <-> WeChat bridge
# Project source code URL: https://github.com/duo/matrix-wechat # Project source code URL: https://github.com/duo/matrix-wechat
matrix_wechat_enabled: true matrix_bridge_wechat_enabled: true
# renovate: datasource=docker depName=lxduo/matrix-wechat # renovate: datasource=docker depName=lxduo/matrix-wechat
matrix_wechat_version: 0.2.4 matrix_bridge_wechat_version: 0.2.4
matrix_wechat_container_image: "{{ matrix_wechat_container_image_registry_prefix }}lxduo/matrix-wechat:{{ matrix_wechat_version }}" matrix_bridge_wechat_container_image: "{{ matrix_bridge_wechat_container_image_registry_prefix }}lxduo/matrix-wechat:{{ matrix_bridge_wechat_version }}"
matrix_wechat_container_image_registry_prefix: "{{ 'localhost/' if matrix_wechat_container_image_self_build else matrix_wechat_container_image_registry_prefix_upstream }}" matrix_bridge_wechat_container_image_registry_prefix: "{{ 'localhost/' if matrix_bridge_wechat_container_image_self_build else matrix_bridge_wechat_container_image_registry_prefix_upstream }}"
matrix_wechat_container_image_registry_prefix_upstream: "{{ matrix_wechat_container_image_registry_prefix_upstream_default }}" matrix_bridge_wechat_container_image_registry_prefix_upstream: "{{ matrix_bridge_wechat_container_image_registry_prefix_upstream_default }}"
matrix_wechat_container_image_registry_prefix_upstream_default: "docker.io/" matrix_bridge_wechat_container_image_registry_prefix_upstream_default: "docker.io/"
matrix_wechat_container_image_self_build: false matrix_bridge_wechat_container_image_self_build: false
matrix_wechat_container_image_self_build_repo: "https://github.com/duo/matrix-wechat.git" matrix_bridge_wechat_container_image_self_build_repo: "https://github.com/duo/matrix-wechat.git"
matrix_wechat_container_image_self_build_branch: "{{ 'master' if matrix_wechat_version == 'latest' else matrix_wechat_version }}" matrix_bridge_wechat_container_image_self_build_branch: "{{ 'master' if matrix_bridge_wechat_version == 'latest' else matrix_bridge_wechat_version }}"
# renovate: datasource=docker depName=lxduo/matrix-wechat-agent # renovate: datasource=docker depName=lxduo/matrix-wechat-agent
matrix_wechat_agent_version: 0.0.1 matrix_bridge_wechat_agent_version: 0.0.1
matrix_wechat_agent_container_image: "{{ matrix_wechat_agent_container_image_registry_prefix }}lxduo/matrix-wechat-agent:{{ matrix_wechat_agent_version }}" matrix_bridge_wechat_agent_container_image: "{{ matrix_bridge_wechat_agent_container_image_registry_prefix }}lxduo/matrix-wechat-agent:{{ matrix_bridge_wechat_agent_version }}"
matrix_wechat_agent_container_image_registry_prefix: "{{ 'localhost/' if matrix_wechat_agent_container_image_self_build else matrix_wechat_agent_container_image_registry_prefix_upstream }}" matrix_bridge_wechat_agent_container_image_registry_prefix: "{{ 'localhost/' if matrix_bridge_wechat_agent_container_image_self_build else matrix_bridge_wechat_agent_container_image_registry_prefix_upstream }}"
matrix_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_wechat_agent_container_image_registry_prefix_upstream_default }}" matrix_bridge_wechat_agent_container_image_registry_prefix_upstream: "{{ matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default }}"
matrix_wechat_agent_container_image_registry_prefix_upstream_default: "docker.io/" matrix_bridge_wechat_agent_container_image_registry_prefix_upstream_default: "docker.io/"
# The agent needs to write to /home/user/.vnc. # The agent needs to write to /home/user/.vnc.
# `/home/user` is owned by `user:group` (`1000:1000`), so it needs to run with that user/group. # `/home/user` is owned by `user:group` (`1000:1000`), so it needs to run with that user/group.
matrix_wechat_agent_container_user_uid: 1000 matrix_bridge_wechat_agent_container_user_uid: 1000
matrix_wechat_agent_container_user_gid: 1000 matrix_bridge_wechat_agent_container_user_gid: 1000
matrix_wechat_agent_container_image_self_build: false matrix_bridge_wechat_agent_container_image_self_build: false
matrix_wechat_agent_container_image_self_build_repo: "https://github.com/duo/matrix-wechat-agent.git" matrix_bridge_wechat_agent_container_image_self_build_repo: "https://github.com/duo/matrix-wechat-agent.git"
matrix_wechat_agent_container_image_self_build_branch: "{{ 'master' if matrix_wechat_agent_version == 'latest' else matrix_wechat_agent_version }}" matrix_bridge_wechat_agent_container_image_self_build_branch: "{{ 'master' if matrix_bridge_wechat_agent_version == 'latest' else matrix_bridge_wechat_agent_version }}"
matrix_wechat_base_path: "{{ matrix_base_data_path }}/wechat" matrix_bridge_wechat_base_path: "{{ matrix_base_data_path }}/wechat"
matrix_wechat_config_path: "{{ matrix_wechat_base_path }}/config" matrix_bridge_wechat_config_path: "{{ matrix_bridge_wechat_base_path }}/config"
matrix_wechat_data_path: "{{ matrix_wechat_base_path }}/data" matrix_bridge_wechat_data_path: "{{ matrix_bridge_wechat_base_path }}/data"
matrix_wechat_container_src_files_path: "{{ matrix_wechat_base_path }}/container-src" matrix_bridge_wechat_container_src_files_path: "{{ matrix_bridge_wechat_base_path }}/container-src"
matrix_wechat_agent_container_src_files_path: "{{ matrix_wechat_base_path }}/agent-container-src" matrix_bridge_wechat_agent_container_src_files_path: "{{ matrix_bridge_wechat_base_path }}/agent-container-src"
matrix_wechat_homeserver_address: "" matrix_bridge_wechat_homeserver_address: ""
matrix_wechat_homeserver_domain: "{{ matrix_domain }}" matrix_bridge_wechat_homeserver_domain: "{{ matrix_domain }}"
# Whether asynchronous uploads via MSC2246 should be enabled for media. # Whether asynchronous uploads via MSC2246 should be enabled for media.
# Requires a homeserver that supports MSC2246 (https://github.com/matrix-org/matrix-spec-proposals/pull/2246). # Requires a homeserver that supports MSC2246 (https://github.com/matrix-org/matrix-spec-proposals/pull/2246).
matrix_wechat_homeserver_async_media: false matrix_bridge_wechat_homeserver_async_media: false
matrix_wechat_appservice_address: 'http://matrix-wechat:8080' matrix_bridge_wechat_appservice_address: 'http://matrix-wechat:8080'
matrix_wechat_container_network: "" matrix_bridge_wechat_container_network: ""
matrix_wechat_container_additional_networks: "{{ matrix_wechat_container_additional_networks_auto + matrix_wechat_container_additional_networks_custom }}" matrix_bridge_wechat_container_additional_networks: "{{ matrix_bridge_wechat_container_additional_networks_auto + matrix_bridge_wechat_container_additional_networks_custom }}"
matrix_wechat_container_additional_networks_auto: [] matrix_bridge_wechat_container_additional_networks_auto: []
matrix_wechat_container_additional_networks_custom: [] matrix_bridge_wechat_container_additional_networks_custom: []
# A list of extra arguments to pass to the container # A list of extra arguments to pass to the container
matrix_wechat_container_extra_arguments: [] matrix_bridge_wechat_container_extra_arguments: []
# List of systemd services that matrix-wechat.service depends on. # List of systemd services that matrix-wechat.service depends on.
matrix_wechat_systemd_required_services_list: "{{ matrix_wechat_systemd_required_services_list_default + matrix_wechat_systemd_required_services_list_auto + matrix_wechat_systemd_required_services_list_custom }}" matrix_bridge_wechat_systemd_required_services_list: "{{ matrix_bridge_wechat_systemd_required_services_list_default + matrix_bridge_wechat_systemd_required_services_list_auto + matrix_bridge_wechat_systemd_required_services_list_custom }}"
matrix_wechat_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" matrix_bridge_wechat_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}"
matrix_wechat_systemd_required_services_list_auto: [] matrix_bridge_wechat_systemd_required_services_list_auto: []
matrix_wechat_systemd_required_services_list_custom: [] matrix_bridge_wechat_systemd_required_services_list_custom: []
# List of systemd services that matrix-wechat.service wants # List of systemd services that matrix-wechat.service wants
matrix_wechat_systemd_wanted_services_list: [] matrix_bridge_wechat_systemd_wanted_services_list: []
matrix_wechat_appservice_token: '' matrix_bridge_wechat_appservice_token: ''
matrix_wechat_homeserver_token: '' matrix_bridge_wechat_homeserver_token: ''
matrix_wechat_appservice_bot_username: wechatbot matrix_bridge_wechat_appservice_bot_username: wechatbot
matrix_wechat_command_prefix: "!wechat" matrix_bridge_wechat_command_prefix: "!wechat"
# Whether or not created rooms should have federation enabled. # Whether or not created rooms should have federation enabled.
# If false, created portal rooms will never be federated. # If false, created portal rooms will never be federated.
matrix_wechat_federate_rooms: true matrix_bridge_wechat_federate_rooms: true
# Database-related configuration fields. # Database-related configuration fields.
matrix_wechat_database_engine: 'postgres' matrix_bridge_wechat_database_engine: 'postgres'
matrix_wechat_database_username: 'matrix_wechat' matrix_bridge_wechat_database_username: 'matrix_wechat'
matrix_wechat_database_password: 'some-password' matrix_bridge_wechat_database_password: 'some-password'
matrix_wechat_database_hostname: '' matrix_bridge_wechat_database_hostname: ''
matrix_wechat_database_port: 5432 matrix_bridge_wechat_database_port: 5432
matrix_wechat_database_name: 'matrix_wechat' matrix_bridge_wechat_database_name: 'matrix_wechat'
matrix_wechat_database_sslmode: disable matrix_bridge_wechat_database_sslmode: disable
matrix_wechat_database_connection_string: 'postgresql://{{ matrix_wechat_database_username }}:{{ matrix_wechat_database_password }}@{{ matrix_wechat_database_hostname }}:{{ matrix_wechat_database_port }}/{{ matrix_wechat_database_name }}?sslmode={{ matrix_wechat_database_sslmode }}' matrix_bridge_wechat_database_connection_string: 'postgresql://{{ matrix_bridge_wechat_database_username }}:{{ matrix_bridge_wechat_database_password }}@{{ matrix_bridge_wechat_database_hostname }}:{{ matrix_bridge_wechat_database_port }}/{{ matrix_bridge_wechat_database_name }}?sslmode={{ matrix_bridge_wechat_database_sslmode }}'
matrix_wechat_bridge_listen_secret: '' matrix_bridge_wechat_bridge_listen_secret: ''
# Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth). # Can be set to enable automatic double-puppeting via Shared Secret Auth (https://github.com/devture/matrix-synapse-shared-secret-auth).
matrix_wechat_login_shared_secret: '' matrix_bridge_wechat_login_shared_secret: ''
matrix_wechat_login_shared_secret_map: matrix_bridge_wechat_login_shared_secret_map:
"{{ {matrix_wechat_homeserver_domain: matrix_wechat_login_shared_secret} if matrix_wechat_login_shared_secret else {} }}" "{{ {matrix_bridge_wechat_homeserver_domain: matrix_bridge_wechat_login_shared_secret} if matrix_bridge_wechat_login_shared_secret else {} }}"
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
matrix_wechat_double_puppet_server_map: matrix_bridge_wechat_double_puppet_server_map:
"{{ matrix_wechat_homeserver_domain: matrix_wechat_homeserver_address }}" "{{ matrix_bridge_wechat_homeserver_domain: matrix_bridge_wechat_homeserver_address }}"
# Enable End-to-bridge encryption # Enable End-to-bridge encryption
matrix_wechat_encryption_allow: "{{ matrix_bridges_encryption_enabled }}" matrix_bridge_wechat_encryption_allow: "{{ matrix_bridges_encryption_enabled }}"
matrix_wechat_encryption_default: "{{ matrix_wechat_encryption_allow }}" matrix_bridge_wechat_encryption_default: "{{ matrix_bridge_wechat_encryption_allow }}"
# Minimum severity of journal log messages. # Minimum severity of journal log messages.
# Valid values: fatal, error, warn, info, debug # Valid values: fatal, error, warn, info, debug
matrix_wechat_log_level: 'warn' matrix_bridge_wechat_log_level: 'warn'
matrix_wechat_permissions: | matrix_bridge_wechat_permissions: |
{{ {{
{matrix_wechat_homeserver_domain: 'user'} {matrix_bridge_wechat_homeserver_domain: 'user'}
| combine({matrix_admin: 'admin'} if matrix_admin else {}) | combine({matrix_admin: 'admin'} if matrix_admin else {})
}} }}
# Default Wechat configuration template which covers the generic use case. # Default Wechat configuration template which covers the generic use case.
# You can customize it by controlling the various variables inside it. # You can customize it by controlling the various variables inside it.
# #
# For a more advanced customization, you can extend the default (see `matrix_wechat_configuration_extension_yaml`) # For a more advanced customization, you can extend the default (see `matrix_bridge_wechat_configuration_extension_yaml`)
# or completely replace this variable with your own template. # or completely replace this variable with your own template.
matrix_wechat_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" matrix_bridge_wechat_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}"
matrix_wechat_configuration_extension_yaml: | matrix_bridge_wechat_configuration_extension_yaml: |
# Your custom YAML configuration goes here. # Your custom YAML configuration goes here.
# This configuration extends the default starting configuration (`matrix_wechat_configuration_yaml`). # This configuration extends the default starting configuration (`matrix_bridge_wechat_configuration_yaml`).
# #
# You can override individual variables from the default configuration, or introduce new ones. # You can override individual variables from the default configuration, or introduce new ones.
# #
# If you need something more special, you can take full control by # If you need something more special, you can take full control by
# completely redefining `matrix_wechat_configuration_yaml`. # completely redefining `matrix_bridge_wechat_configuration_yaml`.
matrix_wechat_configuration_extension: "{{ matrix_wechat_configuration_extension_yaml | from_yaml if matrix_wechat_configuration_extension_yaml | from_yaml is mapping else {} }}" matrix_bridge_wechat_configuration_extension: "{{ matrix_bridge_wechat_configuration_extension_yaml | from_yaml if matrix_bridge_wechat_configuration_extension_yaml | from_yaml is mapping else {} }}"
# Holds the final configuration (a combination of the default and its extension). # Holds the final configuration (a combination of the default and its extension).
# You most likely don't need to touch this variable. Instead, see `matrix_wechat_configuration_yaml`. # You most likely don't need to touch this variable. Instead, see `matrix_bridge_wechat_configuration_yaml`.
matrix_wechat_configuration: "{{ matrix_wechat_configuration_yaml | from_yaml | combine(matrix_wechat_configuration_extension, recursive=True) }}" matrix_bridge_wechat_configuration: "{{ matrix_bridge_wechat_configuration_yaml | from_yaml | combine(matrix_bridge_wechat_configuration_extension, recursive=True) }}"
matrix_wechat_registration_yaml: | matrix_bridge_wechat_registration_yaml: |
id: wechat id: wechat
url: {{ matrix_wechat_appservice_address }} url: {{ matrix_bridge_wechat_appservice_address }}
as_token: "{{ matrix_wechat_appservice_token }}" as_token: "{{ matrix_bridge_wechat_appservice_token }}"
hs_token: "{{ matrix_wechat_homeserver_token }}" hs_token: "{{ matrix_bridge_wechat_homeserver_token }}"
# See https://github.com/mautrix/signal/issues/43 # See https://github.com/mautrix/signal/issues/43
sender_localpart: _bot_{{ matrix_wechat_appservice_bot_username }} sender_localpart: _bot_{{ matrix_bridge_wechat_appservice_bot_username }}
rate_limited: false rate_limited: false
namespaces: namespaces:
users: users:
- regex: '^@_wechat_(.*):{{ matrix_wechat_homeserver_domain | regex_escape }}$' - regex: '^@_wechat_(.*):{{ matrix_bridge_wechat_homeserver_domain | regex_escape }}$'
exclusive: true exclusive: true
- exclusive: true - exclusive: true
regex: '^@{{ matrix_wechat_appservice_bot_username | regex_escape }}:{{ matrix_wechat_homeserver_domain | regex_escape }}$' regex: '^@{{ matrix_bridge_wechat_appservice_bot_username | regex_escape }}:{{ matrix_bridge_wechat_homeserver_domain | regex_escape }}$'
de.sorunome.msc2409.push_ephemeral: true de.sorunome.msc2409.push_ephemeral: true
receive_ephemeral: true receive_ephemeral: true
matrix_wechat_registration: "{{ matrix_wechat_registration_yaml | from_yaml }}" matrix_bridge_wechat_registration: "{{ matrix_bridge_wechat_registration_yaml | from_yaml }}"
matrix_wechat_agent_service_secret: "{{ matrix_wechat_bridge_listen_secret }}" matrix_bridge_wechat_agent_service_secret: "{{ matrix_bridge_wechat_bridge_listen_secret }}"
matrix_wechat_agent_configuration_yaml: "{{ lookup('template', 'templates/agent-config.yaml.j2') }}" matrix_bridge_wechat_agent_configuration_yaml: "{{ lookup('template', 'templates/agent-config.yaml.j2') }}"
matrix_wechat_agent_configuration: "{{ matrix_wechat_agent_configuration_yaml | from_yaml }}" matrix_bridge_wechat_agent_configuration: "{{ matrix_bridge_wechat_agent_configuration_yaml | from_yaml }}"
# matrix_wechat_restart_necessary controls whether the service # matrix_bridge_wechat_restart_necessary controls whether the service
# will be restarted (when true) or merely started (when false) by the # will be restarted (when true) or merely started (when false) by the
# systemd service manager role (when conditional restart is enabled). # systemd service manager role (when conditional restart is enabled).
# #
@@ -170,4 +170,4 @@ matrix_wechat_agent_configuration: "{{ matrix_wechat_agent_configuration_yaml |
# any configuration files, the systemd service file, or the container image changed. # any configuration files, the systemd service file, or the container image changed.
# The default of `false` means "no restart needed" — appropriate when the role's # The default of `false` means "no restart needed" — appropriate when the role's
# installation tasks haven't run (e.g., due to --tags skipping them). # installation tasks haven't run (e.g., due to --tags skipping them).
matrix_wechat_restart_necessary: false matrix_bridge_wechat_restart_necessary: false
@@ -13,107 +13,107 @@
owner: "{{ matrix_user_name }}" owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}" group: "{{ matrix_group_name }}"
with_items: with_items:
- {path: "{{ matrix_wechat_base_path }}", when: true} - {path: "{{ matrix_bridge_wechat_base_path }}", when: true}
- {path: "{{ matrix_wechat_config_path }}", when: true} - {path: "{{ matrix_bridge_wechat_config_path }}", when: true}
- {path: "{{ matrix_wechat_data_path }}", when: true} - {path: "{{ matrix_bridge_wechat_data_path }}", when: true}
- {path: "{{ matrix_wechat_container_src_files_path }}", when: "{{ matrix_wechat_container_image_self_build }}"} - {path: "{{ matrix_bridge_wechat_container_src_files_path }}", when: "{{ matrix_bridge_wechat_container_image_self_build }}"}
- {path: "{{ matrix_wechat_agent_container_src_files_path }}", when: "{{ matrix_wechat_agent_container_image_self_build }}"} - {path: "{{ matrix_bridge_wechat_agent_container_src_files_path }}", when: "{{ matrix_bridge_wechat_agent_container_image_self_build }}"}
when: item.when | bool when: item.when | bool
- name: Ensure WeChat Bridge image is pulled - name: Ensure WeChat Bridge image is pulled
community.docker.docker_image_pull: community.docker.docker_image_pull:
name: "{{ matrix_wechat_container_image }}" name: "{{ matrix_bridge_wechat_container_image }}"
pull: always pull: always
when: not matrix_wechat_container_image_self_build when: not matrix_bridge_wechat_container_image_self_build
register: matrix_wechat_container_image_pull_result register: matrix_bridge_wechat_container_image_pull_result
retries: "{{ devture_playbook_help_container_retries_count }}" retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}" delay: "{{ devture_playbook_help_container_retries_delay }}"
until: matrix_wechat_container_image_pull_result is not failed until: matrix_bridge_wechat_container_image_pull_result is not failed
- when: matrix_wechat_container_image_self_build | bool - when: matrix_bridge_wechat_container_image_self_build | bool
block: block:
- name: Ensure WeChat Bridge repository is present on self-build - name: Ensure WeChat Bridge repository is present on self-build
ansible.builtin.git: ansible.builtin.git:
repo: "{{ matrix_wechat_container_image_self_build_repo }}" repo: "{{ matrix_bridge_wechat_container_image_self_build_repo }}"
dest: "{{ matrix_wechat_container_src_files_path }}" dest: "{{ matrix_bridge_wechat_container_src_files_path }}"
version: "{{ matrix_wechat_container_image_self_build_branch }}" version: "{{ matrix_bridge_wechat_container_image_self_build_branch }}"
force: "yes" force: "yes"
become: true become: true
become_user: "{{ matrix_user_name }}" become_user: "{{ matrix_user_name }}"
register: matrix_wechat_git_pull_results register: matrix_bridge_wechat_git_pull_results
- name: Ensure WeChat Bridge container image is built - name: Ensure WeChat Bridge container image is built
community.docker.docker_image_build: community.docker.docker_image_build:
name: "{{ matrix_wechat_container_image }}" name: "{{ matrix_bridge_wechat_container_image }}"
dockerfile: Dockerfile dockerfile: Dockerfile
path: "{{ matrix_wechat_container_src_files_path }}" path: "{{ matrix_bridge_wechat_container_src_files_path }}"
pull: true pull: true
rebuild: "{{ 'always' if matrix_wechat_git_pull_results.changed | bool else 'never' }}" rebuild: "{{ 'always' if matrix_bridge_wechat_git_pull_results.changed | bool else 'never' }}"
register: matrix_wechat_container_image_build_result register: matrix_bridge_wechat_container_image_build_result
- name: Ensure WeChat Agent image is pulled - name: Ensure WeChat Agent image is pulled
community.docker.docker_image_pull: community.docker.docker_image_pull:
name: "{{ matrix_wechat_agent_container_image }}" name: "{{ matrix_bridge_wechat_agent_container_image }}"
pull: always pull: always
when: not matrix_wechat_agent_container_image_self_build when: not matrix_bridge_wechat_agent_container_image_self_build
register: matrix_wechat_agent_container_image_pull_result register: matrix_bridge_wechat_agent_container_image_pull_result
retries: "{{ devture_playbook_help_container_retries_count }}" retries: "{{ devture_playbook_help_container_retries_count }}"
delay: "{{ devture_playbook_help_container_retries_delay }}" delay: "{{ devture_playbook_help_container_retries_delay }}"
until: matrix_wechat_agent_container_image_pull_result is not failed until: matrix_bridge_wechat_agent_container_image_pull_result is not failed
- when: matrix_wechat_agent_container_image_self_build | bool - when: matrix_bridge_wechat_agent_container_image_self_build | bool
block: block:
- name: Ensure WeChat Agent repository is present on self-build - name: Ensure WeChat Agent repository is present on self-build
ansible.builtin.git: ansible.builtin.git:
repo: "{{ matrix_wechat_agent_container_image_self_build_repo }}" repo: "{{ matrix_bridge_wechat_agent_container_image_self_build_repo }}"
dest: "{{ matrix_wechat_agent_container_src_files_path }}" dest: "{{ matrix_bridge_wechat_agent_container_src_files_path }}"
version: "{{ matrix_wechat_agent_container_image_self_build_branch }}" version: "{{ matrix_bridge_wechat_agent_container_image_self_build_branch }}"
force: "yes" force: "yes"
become: true become: true
become_user: "{{ matrix_user_name }}" become_user: "{{ matrix_user_name }}"
register: matrix_wechat_agent_git_pull_results register: matrix_bridge_wechat_agent_git_pull_results
- name: Ensure WeChat Agent container image is built - name: Ensure WeChat Agent container image is built
community.docker.docker_image_build: community.docker.docker_image_build:
name: "{{ matrix_wechat_agent_container_image }}" name: "{{ matrix_bridge_wechat_agent_container_image }}"
dockerfile: Dockerfile dockerfile: Dockerfile
path: "{{ matrix_wechat_agent_container_src_files_path }}" path: "{{ matrix_bridge_wechat_agent_container_src_files_path }}"
pull: true pull: true
rebuild: "{{ 'always' if matrix_wechat_agent_git_pull_results.changed | bool else 'never' }}" rebuild: "{{ 'always' if matrix_bridge_wechat_agent_git_pull_results.changed | bool else 'never' }}"
register: matrix_wechat_agent_container_image_build_result register: matrix_bridge_wechat_agent_container_image_build_result
- name: Ensure WeChat configuration installed - name: Ensure WeChat configuration installed
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ matrix_wechat_configuration | to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bridge_wechat_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_wechat_config_path }}/config.yaml" dest: "{{ matrix_bridge_wechat_config_path }}/config.yaml"
mode: '0644' mode: '0644'
owner: "{{ matrix_user_name }}" owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}" group: "{{ matrix_group_name }}"
register: matrix_wechat_config_result register: matrix_bridge_wechat_config_result
- name: Ensure WeChat registration.yaml installed - name: Ensure WeChat registration.yaml installed
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ matrix_wechat_registration | to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bridge_wechat_registration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_wechat_config_path }}/registration.yaml" dest: "{{ matrix_bridge_wechat_config_path }}/registration.yaml"
mode: '0644' mode: '0644'
owner: "{{ matrix_user_name }}" owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}" group: "{{ matrix_group_name }}"
register: matrix_wechat_registration_result register: matrix_bridge_wechat_registration_result
- name: Ensure Wechat Agent configuration installed - name: Ensure Wechat Agent configuration installed
ansible.builtin.copy: ansible.builtin.copy:
content: "{{ matrix_wechat_agent_configuration | to_nice_yaml(indent=2, width=999999) }}" content: "{{ matrix_bridge_wechat_agent_configuration | to_nice_yaml(indent=2, width=999999) }}"
dest: "{{ matrix_wechat_config_path }}/agent-config.yaml" dest: "{{ matrix_bridge_wechat_config_path }}/agent-config.yaml"
mode: '0644' mode: '0644'
owner: "{{ matrix_user_name }}" owner: "{{ matrix_user_name }}"
group: "{{ matrix_group_name }}" group: "{{ matrix_group_name }}"
register: matrix_wechat_agent_config_result register: matrix_bridge_wechat_agent_config_result
- name: Ensure matrix-wechat container network is created - name: Ensure matrix-wechat container network is created
when: matrix_wechat_container_network != 'host' when: matrix_bridge_wechat_container_network != 'host'
community.general.docker_network: community.general.docker_network:
enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
name: "{{ matrix_wechat_container_network }}" name: "{{ matrix_bridge_wechat_container_network }}"
driver: bridge driver: bridge
driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
@@ -122,26 +122,26 @@
src: "{{ role_path }}/templates/systemd/matrix-wechat.service.j2" src: "{{ role_path }}/templates/systemd/matrix-wechat.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat.service" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat.service"
mode: '0644' mode: '0644'
register: matrix_wechat_systemd_service_result register: matrix_bridge_wechat_systemd_service_result
- name: Ensure matrix-wechat-agent.service installed - name: Ensure matrix-wechat-agent.service installed
ansible.builtin.template: ansible.builtin.template:
src: "{{ role_path }}/templates/systemd/matrix-wechat-agent.service.j2" src: "{{ role_path }}/templates/systemd/matrix-wechat-agent.service.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat-agent.service" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-wechat-agent.service"
mode: '0644' mode: '0644'
register: matrix_wechat_agent_systemd_service_result register: matrix_bridge_wechat_agent_systemd_service_result
- name: Determine whether WeChat Bridge needs a restart - name: Determine whether WeChat Bridge needs a restart
ansible.builtin.set_fact: ansible.builtin.set_fact:
matrix_wechat_restart_necessary: >- matrix_bridge_wechat_restart_necessary: >-
{{ {{
matrix_wechat_config_result.changed | default(false) matrix_bridge_wechat_config_result.changed | default(false)
or matrix_wechat_registration_result.changed | default(false) or matrix_bridge_wechat_registration_result.changed | default(false)
or matrix_wechat_agent_config_result.changed | default(false) or matrix_bridge_wechat_agent_config_result.changed | default(false)
or matrix_wechat_systemd_service_result.changed | default(false) or matrix_bridge_wechat_systemd_service_result.changed | default(false)
or matrix_wechat_agent_systemd_service_result.changed | default(false) or matrix_bridge_wechat_agent_systemd_service_result.changed | default(false)
or matrix_wechat_container_image_pull_result.changed | default(false) or matrix_bridge_wechat_container_image_pull_result.changed | default(false)
or matrix_wechat_agent_container_image_pull_result.changed | default(false) or matrix_bridge_wechat_agent_container_image_pull_result.changed | default(false)
or matrix_wechat_container_image_build_result.changed | default(false) or matrix_bridge_wechat_container_image_build_result.changed | default(false)
or matrix_wechat_agent_container_image_build_result.changed | default(false) or matrix_bridge_wechat_agent_container_image_build_result.changed | default(false)
}} }}
@@ -10,15 +10,15 @@
- install-all - install-all
- install-wechat - install-wechat
block: block:
- when: matrix_wechat_enabled | bool - when: matrix_bridge_wechat_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
- when: matrix_wechat_enabled | bool - when: matrix_bridge_wechat_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/install.yml"
- tags: - tags:
- setup-all - setup-all
- setup-wechat - setup-wechat
block: block:
- when: not matrix_wechat_enabled | bool - when: not matrix_bridge_wechat_enabled | bool
ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml" ansible.builtin.include_tasks: "{{ role_path }}/tasks/uninstall.yml"
@@ -7,9 +7,9 @@
- name: Check existence of matrix-wechat service - name: Check existence of matrix-wechat service
ansible.builtin.stat: ansible.builtin.stat:
path: "/etc/systemd/system/matrix-wechat.service" path: "/etc/systemd/system/matrix-wechat.service"
register: matrix_wechat_service_stat register: matrix_bridge_wechat_service_stat
- when: matrix_wechat_service_stat.stat.exists | bool - when: matrix_bridge_wechat_service_stat.stat.exists | bool
block: block:
- name: Ensure matrix-wechat is stopped - name: Ensure matrix-wechat is stopped
ansible.builtin.service: ansible.builtin.service:
@@ -26,9 +26,9 @@
- name: Check existence of matrix-wechat-agent service - name: Check existence of matrix-wechat-agent service
ansible.builtin.stat: ansible.builtin.stat:
path: "/etc/systemd/system/matrix-wechat-agent.service" path: "/etc/systemd/system/matrix-wechat-agent.service"
register: matrix_wechat_agent_service_stat register: matrix_bridge_wechat_agent_service_stat
- when: matrix_wechat_agent_service_stat.stat.exists | bool - when: matrix_bridge_wechat_agent_service_stat.stat.exists | bool
block: block:
- name: Ensure matrix-wechat-agent is stopped - name: Ensure matrix-wechat-agent is stopped
ansible.builtin.service: ansible.builtin.service:
@@ -10,12 +10,12 @@
You need to define a required configuration setting (`{{ item.name }}`). You need to define a required configuration setting (`{{ item.name }}`).
when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0"
with_items: with_items:
- {'name': 'matrix_wechat_appservice_token', when: true} - {'name': 'matrix_bridge_wechat_appservice_token', when: true}
- {'name': 'matrix_wechat_homeserver_address', when: true} - {'name': 'matrix_bridge_wechat_homeserver_address', when: true}
- {'name': 'matrix_wechat_homeserver_token', when: true} - {'name': 'matrix_bridge_wechat_homeserver_token', when: true}
- {'name': 'matrix_wechat_database_hostname', when: "{{ matrix_wechat_database_engine == 'postgres' }}"} - {'name': 'matrix_bridge_wechat_database_hostname', when: "{{ matrix_bridge_wechat_database_engine == 'postgres' }}"}
- {'name': 'matrix_wechat_container_network', when: true} - {'name': 'matrix_bridge_wechat_container_network', when: true}
- {'name': 'matrix_wechat_bridge_listen_secret', when: true} - {'name': 'matrix_bridge_wechat_bridge_listen_secret', when: true}
- name: Fail if WeChat enabled on ARM64 (not supported by the wechat agent, even with self-building) - name: Fail if WeChat enabled on ARM64 (not supported by the wechat agent, even with self-building)
when: matrix_architecture not in ['amd64'] when: matrix_architecture not in ['amd64']
@@ -28,7 +28,7 @@
The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead. The variable `{{ item.old }}` is deprecated. Please use `{{ item.new }}` instead.
when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
with_items: with_items:
- {'old': 'matrix_wechat_container_image_name_prefix', 'new': 'matrix_wechat_container_image_registry_prefix'} - {'old': 'matrix_bridge_wechat_container_image_name_prefix', 'new': 'matrix_bridge_wechat_container_image_registry_prefix'}
- {'old': 'matrix_wechat_agent_container_image_name_prefix', 'new': 'matrix_wechat_agent_container_image_registry_prefix'} - {'old': 'matrix_bridge_wechat_agent_container_image_name_prefix', 'new': 'matrix_bridge_wechat_agent_container_image_registry_prefix'}
- {'old': 'matrix_wechat_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'} - {'old': 'matrix_bridge_wechat_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
- {'old': 'matrix_wechat_agent_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'} - {'old': 'matrix_bridge_wechat_agent_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
@@ -12,7 +12,7 @@ wechat:
service: service:
addr: ws://matrix-wechat:20002 addr: ws://matrix-wechat:20002
secret: {{ matrix_wechat_bridge_listen_secret | to_json }} secret: {{ matrix_bridge_wechat_bridge_listen_secret | to_json }}
ping_interval: 30s ping_interval: 30s
log: log:
@@ -2,9 +2,9 @@
# Homeserver details. # Homeserver details.
homeserver: homeserver:
# The address that this appservice can use to connect to the homeserver. # The address that this appservice can use to connect to the homeserver.
address: {{ matrix_wechat_homeserver_address | to_json }} address: {{ matrix_bridge_wechat_homeserver_address | to_json }}
# The domain of the homeserver (for MXIDs, etc). # The domain of the homeserver (for MXIDs, etc).
domain: {{ matrix_wechat_homeserver_domain | to_json }} domain: {{ matrix_bridge_wechat_homeserver_domain | to_json }}
# What software is the homeserver running? # What software is the homeserver running?
# Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here. # Standard Matrix homeservers like Synapse, Dendrite and Conduit should just use "standard" here.
@@ -16,7 +16,7 @@ homeserver:
# Endpoint for reporting per-message status. # Endpoint for reporting per-message status.
message_send_checkpoint_endpoint: null message_send_checkpoint_endpoint: null
# Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246? # Does the homeserver support https://github.com/matrix-org/matrix-spec-proposals/pull/2246?
async_media: {{ matrix_wechat_homeserver_async_media | to_json }} async_media: {{ matrix_bridge_wechat_homeserver_async_media | to_json }}
# Should the bridge use a websocket for connecting to the homeserver? # Should the bridge use a websocket for connecting to the homeserver?
# The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy, # The server side is currently not documented anywhere and is only implemented by mautrix-wsproxy,
@@ -29,7 +29,7 @@ homeserver:
# Changing these values requires regeneration of the registration. # Changing these values requires regeneration of the registration.
appservice: appservice:
# The address that the homeserver can use to connect to this appservice. # The address that the homeserver can use to connect to this appservice.
address: {{ matrix_wechat_appservice_address | to_json }} address: {{ matrix_bridge_wechat_appservice_address | to_json }}
# The hostname and port where this appservice should listen. # The hostname and port where this appservice should listen.
hostname: 0.0.0.0 hostname: 0.0.0.0
@@ -43,7 +43,7 @@ appservice:
# SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string # SQLite: File name is enough. https://github.com/mattn/go-sqlite3#connection-string
# Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable # Postgres: Connection string. For example, postgres://user:password@host/database?sslmode=disable
# To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql # To connect via Unix socket, use something like postgres:///dbname?host=/var/run/postgresql
uri: {{ matrix_wechat_database_connection_string | to_json }} uri: {{ matrix_bridge_wechat_database_connection_string | to_json }}
# Maximum number of connections. Mostly relevant for Postgres. # Maximum number of connections. Mostly relevant for Postgres.
max_open_conns: 20 max_open_conns: 20
max_idle_conns: 2 max_idle_conns: 2
@@ -57,7 +57,7 @@ appservice:
# Appservice bot details. # Appservice bot details.
bot: bot:
# Username of the appservice bot. # Username of the appservice bot.
username: {{ matrix_wechat_appservice_bot_username | to_json }} username: {{ matrix_bridge_wechat_appservice_bot_username | to_json }}
# Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty # Display name and avatar for bot. Set to "remove" to remove display name/avatar, leave empty
# to leave display name/avatar as-is. # to leave display name/avatar as-is.
displayname: WeChat bridge bot displayname: WeChat bridge bot
@@ -73,8 +73,8 @@ appservice:
async_transactions: false async_transactions: false
# Authentication tokens for AS <-> HS communication. Autogenerated; do not modify. # Authentication tokens for AS <-> HS communication. Autogenerated; do not modify.
as_token: {{ matrix_wechat_appservice_token | to_json }} as_token: {{ matrix_bridge_wechat_appservice_token | to_json }}
hs_token: {{ matrix_wechat_homeserver_token | to_json }} hs_token: {{ matrix_bridge_wechat_homeserver_token | to_json }}
# Bridge config # Bridge config
bridge: bridge:
@@ -85,7 +85,7 @@ bridge:
displayname_template: "{% raw %}{{if .Name}}{{.Name}}{{else}}{{.Uin}}{{end}} (WeChat){% endraw %}" displayname_template: "{% raw %}{{if .Name}}{{.Name}}{{else}}{{.Uin}}{{end}} (WeChat){% endraw %}"
# WeChat listen address (for agent connection) # WeChat listen address (for agent connection)
listen_address: "0.0.0.0:20002" listen_address: "0.0.0.0:20002"
listen_secret: {{ matrix_wechat_bridge_listen_secret | to_json }} listen_secret: {{ matrix_bridge_wechat_bridge_listen_secret | to_json }}
# Should the bridge create a space for each logged-in user and add bridged rooms to it? # Should the bridge create a space for each logged-in user and add bridged rooms to it?
# Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time. # Users who logged in before turning this on should run `!wa sync space` to create and fill the space for the first time.
personal_filtering_spaces: true personal_filtering_spaces: true
@@ -112,7 +112,7 @@ bridge:
send_presence_on_typing: false send_presence_on_typing: false
# Servers to always allow double puppeting from # Servers to always allow double puppeting from
double_puppet_server_map: double_puppet_server_map:
"{{ matrix_wechat_homeserver_domain }}": {{ matrix_wechat_homeserver_address }} "{{ matrix_bridge_wechat_homeserver_domain }}": {{ matrix_bridge_wechat_homeserver_address }}
# Allow using double puppeting from any server with a valid client .well-known file. # Allow using double puppeting from any server with a valid client .well-known file.
double_puppet_allow_discovery: false double_puppet_allow_discovery: false
# Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth # Shared secrets for https://github.com/devture/matrix-synapse-shared-secret-auth
@@ -120,7 +120,7 @@ bridge:
# If set, double puppeting will be enabled automatically for local users # If set, double puppeting will be enabled automatically for local users
# instead of users having to find an access token and run `login-matrix` # instead of users having to find an access token and run `login-matrix`
# manually. # manually.
login_shared_secret_map: {{ matrix_wechat_login_shared_secret_map | to_json }} login_shared_secret_map: {{ matrix_bridge_wechat_login_shared_secret_map | to_json }}
# Whether to explicitly set the avatar and room name for private chat portal rooms. # Whether to explicitly set the avatar and room name for private chat portal rooms.
# If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms. # If set to `default`, this will be enabled in encrypted rooms and disabled in unencrypted rooms.
# If set to `always`, all DM rooms will have explicit names and avatars set. # If set to `always`, all DM rooms will have explicit names and avatars set.
@@ -154,7 +154,7 @@ bridge:
deadline: 120s deadline: 120s
# The prefix for commands. Only required in non-management rooms. # The prefix for commands. Only required in non-management rooms.
command_prefix: {{ matrix_wechat_command_prefix | to_json }} command_prefix: {{ matrix_bridge_wechat_command_prefix | to_json }}
# Messages sent upon joining a management room. # Messages sent upon joining a management room.
# Markdown is supported. The defaults are listed below. # Markdown is supported. The defaults are listed below.
@@ -173,10 +173,10 @@ bridge:
# See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info. # See https://docs.mau.fi/bridges/general/end-to-bridge-encryption.html for more info.
encryption: encryption:
# Allow encryption, work in group chat rooms with e2ee enabled # Allow encryption, work in group chat rooms with e2ee enabled
allow: {{ matrix_wechat_encryption_allow | to_json }} allow: {{ matrix_bridge_wechat_encryption_allow | to_json }}
# Default to encryption, force-enable encryption in all portals the bridge creates # Default to encryption, force-enable encryption in all portals the bridge creates
# This will cause the bridge bot to be in private chats for the encryption to work properly. # This will cause the bridge bot to be in private chats for the encryption to work properly.
default: {{ matrix_wechat_encryption_default | to_json }} default: {{ matrix_bridge_wechat_encryption_default | to_json }}
# Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data. # Whether to use MSC2409/MSC3202 instead of /sync long polling for receiving encryption-related data.
appservice: false appservice: false
# Require encryption, drop any unencrypted messages. # Require encryption, drop any unencrypted messages.
@@ -255,11 +255,11 @@ bridge:
# * - All Matrix users # * - All Matrix users
# domain - All users on that homeserver # domain - All users on that homeserver
# mxid - Specific user # mxid - Specific user
permissions: {{ matrix_wechat_permissions | to_json }} permissions: {{ matrix_bridge_wechat_permissions | to_json }}
# Logging config. See https://github.com/tulir/zeroconfig for details. # Logging config. See https://github.com/tulir/zeroconfig for details.
logging: logging:
min_level: {{ matrix_wechat_log_level }} min_level: {{ matrix_bridge_wechat_log_level }}
writers: writers:
- type: stdout - type: stdout
format: pretty-colored format: pretty-colored
@@ -1,11 +1,11 @@
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
[Unit] [Unit]
Description=Matrix WeChat Agent Description=Matrix WeChat Agent
{% for service in matrix_wechat_systemd_required_services_list %} {% for service in matrix_bridge_wechat_systemd_required_services_list %}
Requires={{ service }} Requires={{ service }}
After={{ service }} After={{ service }}
{% endfor %} {% endfor %}
{% for service in matrix_wechat_systemd_wanted_services_list %} {% for service in matrix_bridge_wechat_systemd_wanted_services_list %}
Wants={{ service }} Wants={{ service }}
{% endfor %} {% endfor %}
DefaultDependencies=no DefaultDependencies=no
@@ -24,17 +24,17 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--rm \ --rm \
--name=matrix-wechat-agent \ --name=matrix-wechat-agent \
--log-driver=none \ --log-driver=none \
--user={{ matrix_wechat_agent_container_user_uid }}:{{ matrix_wechat_agent_container_user_gid }} \ --user={{ matrix_bridge_wechat_agent_container_user_uid }}:{{ matrix_bridge_wechat_agent_container_user_gid }} \
--cap-drop=ALL \ --cap-drop=ALL \
--network={{ matrix_wechat_container_network }} \ --network={{ matrix_bridge_wechat_container_network }} \
--mount type=bind,src={{ matrix_wechat_config_path }}/agent-config.yaml,dst=/home/user/matrix-wechat-agent/configure.yaml,ro \ --mount type=bind,src={{ matrix_bridge_wechat_config_path }}/agent-config.yaml,dst=/home/user/matrix-wechat-agent/configure.yaml,ro \
{% for arg in matrix_wechat_container_extra_arguments %} {% for arg in matrix_bridge_wechat_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
{% endfor %} {% endfor %}
{{ matrix_wechat_agent_container_image }} {{ matrix_bridge_wechat_agent_container_image }}
{% if matrix_wechat_container_network != 'host' %} {% if matrix_bridge_wechat_container_network != 'host' %}
{% for network in matrix_wechat_container_additional_networks %} {% for network in matrix_bridge_wechat_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat-agent ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat-agent
{% endfor %} {% endfor %}
{% endif %} {% endif %}
@@ -1,11 +1,11 @@
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
[Unit] [Unit]
Description=Matrix WeChat Bridge Description=Matrix WeChat Bridge
{% for service in matrix_wechat_systemd_required_services_list %} {% for service in matrix_bridge_wechat_systemd_required_services_list %}
Requires={{ service }} Requires={{ service }}
After={{ service }} After={{ service }}
{% endfor %} {% endfor %}
{% for service in matrix_wechat_systemd_wanted_services_list %} {% for service in matrix_bridge_wechat_systemd_wanted_services_list %}
Wants={{ service }} Wants={{ service }}
{% endfor %} {% endfor %}
DefaultDependencies=no DefaultDependencies=no
@@ -22,17 +22,17 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
--log-driver=none \ --log-driver=none \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \ --cap-drop=ALL \
--network={{ matrix_wechat_container_network }} \ --network={{ matrix_bridge_wechat_container_network }} \
--mount type=bind,src={{ matrix_wechat_config_path }},dst=/config,ro \ --mount type=bind,src={{ matrix_bridge_wechat_config_path }},dst=/config,ro \
--mount type=bind,src={{ matrix_wechat_data_path }},dst=/data \ --mount type=bind,src={{ matrix_bridge_wechat_data_path }},dst=/data \
--workdir=/data \ --workdir=/data \
{% for arg in matrix_wechat_container_extra_arguments %} {% for arg in matrix_bridge_wechat_container_extra_arguments %}
{{ arg }} \ {{ arg }} \
{% endfor %} {% endfor %}
{{ matrix_wechat_container_image }} \ {{ matrix_bridge_wechat_container_image }} \
/usr/bin/matrix-wechat -c /config/config.yaml -r /config/registration.yaml --no-update /usr/bin/matrix-wechat -c /config/config.yaml -r /config/registration.yaml --no-update
{% if matrix_wechat_container_network != 'host' %} {% if matrix_bridge_wechat_container_network != 'host' %}
{% for network in matrix_wechat_container_additional_networks %} {% for network in matrix_bridge_wechat_container_additional_networks %}
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-wechat
{% endfor %} {% endfor %}
{% endif %} {% endif %}