diff --git a/docs/configuring-playbook-bridge-appservice-discord.md b/docs/configuring-playbook-bridge-appservice-discord.md index 6c4f77a73..98a8c950c 100644 --- a/docs/configuring-playbook-bridge-appservice-discord.md +++ b/docs/configuring-playbook-bridge-appservice-discord.md @@ -26,9 +26,9 @@ Create a Discord Application [here](https://discordapp.com/developers/applicatio To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: ```yaml -matrix_appservice_discord_enabled: true -matrix_appservice_discord_client_id: "YOUR DISCORD APP CLIENT ID" -matrix_appservice_discord_bot_token: "YOUR DISCORD APP BOT TOKEN" +matrix_bridge_appservice_discord_enabled: true +matrix_bridge_appservice_discord_client_id: "YOUR DISCORD APP CLIENT ID" +matrix_bridge_appservice_discord_bot_token: "YOUR DISCORD APP BOT TOKEN" # As of Synapse 1.90.0, uncomment to enable the backwards compatibility (https://matrix-org.github.io/synapse/latest/upgrade#upgrading-to-v1900) that this bridge needs. # Note: This deprecated method is considered insecure. @@ -44,7 +44,7 @@ There are some additional things you may wish to configure about the bridge. Take a look at: - `roles/custom/matrix-bridge-appservice-discord/defaults/main.yml` for some variables that you can customize via your `vars.yml` file -- `roles/custom/matrix-bridge-appservice-discord/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_appservice_discord_configuration_extension_yaml` variable +- `roles/custom/matrix-bridge-appservice-discord/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_appservice_discord_configuration_extension_yaml` variable ## Installing @@ -65,7 +65,7 @@ The shortcut commands with the [`just` program](just.md) are also available: `ju Self-service bridging allows you to bridge specific and existing Matrix rooms to specific Discord rooms. To enable it, add the following configuration to your `vars.yml` file: ```yaml -matrix_appservice_discord_bridge_enableSelfServiceBridging: true +matrix_bridge_appservice_discord_bridge_enableSelfServiceBridging: true ``` **Note**: If self-service bridging is not enabled, `!discord help` commands will return no results. @@ -91,14 +91,14 @@ All Matrix rooms created this way are **listed publicly** by default, and you wi To disable portal bridging, add the following configuration to your `vars.yml` file: ```yaml -matrix_appservice_discord_bridge_disablePortalBridging: true +matrix_bridge_appservice_discord_bridge_disablePortalBridging: true ``` ### Usage To get started with Portal Bridging: -1. To invite the bot to Discord, retrieve the invite link from the `{{ matrix_appservice_discord_config_path }}/invite_link` file on the server (this defaults to `/matrix/appservice-discord/config/invite_link`). You need to peek at the file on the server via SSH, etc., because it's not available via HTTP(S). +1. To invite the bot to Discord, retrieve the invite link from the `{{ matrix_bridge_appservice_discord_config_path }}/invite_link` file on the server (this defaults to `/matrix/appservice-discord/config/invite_link`). You need to peek at the file on the server via SSH, etc., because it's not available via HTTP(S). 2. Room addresses follow this syntax: `#_discord__`. You can easily find the guild and channel IDs by logging into Discord in a browser and opening the desired channel. The URL will have this format: `discord.com/channels//`. 3. Once you have figured out the appropriate room address, you can join by doing `/join #_discord__` in your Matrix client. @@ -124,7 +124,7 @@ As with all other services, you can find the logs in [systemd-journald](https:// The default logging level for this component is `warn`. If you want to increase the verbosity, add the following configuration to your `vars.yml` file (adapt to your needs) and re-run the playbook: ```yaml -matrix_appservice_discord_configuration_extension_yaml: | +matrix_bridge_appservice_discord_configuration_extension_yaml: | logging: # What level should the logger output to the console at. console: "info" # Valid values: silent, error, warn, http, info, verbose, silly diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 1c04c7d11..0707c2718 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -94,7 +94,7 @@ aux_file_default_group: "{{ matrix_group_name }}" matrix_homeserver_container_extra_arguments_auto: | {{ - (['--mount type=bind,src=' + matrix_appservice_discord_config_path + '/registration.yaml,dst=/matrix-appservice-discord-registration.yaml,ro'] if matrix_appservice_discord_enabled else []) + (['--mount type=bind,src=' + matrix_bridge_appservice_discord_config_path + '/registration.yaml,dst=/matrix-appservice-discord-registration.yaml,ro'] if matrix_bridge_appservice_discord_enabled else []) + (['--mount type=bind,src=' + matrix_appservice_draupnir_for_all_config_path + '/draupnir-for-all-registration.yaml,dst=/matrix-appservice-draupnir-for-all-registration.yaml,ro'] if matrix_appservice_draupnir_for_all_enabled else []) + @@ -153,7 +153,7 @@ matrix_homeserver_container_extra_arguments_auto: | matrix_homeserver_app_service_config_files_auto: | {{ - (['/matrix-appservice-discord-registration.yaml'] if matrix_appservice_discord_enabled else []) + (['/matrix-appservice-discord-registration.yaml'] if matrix_bridge_appservice_discord_enabled else []) + (['/matrix-appservice-draupnir-for-all-registration.yaml'] if matrix_appservice_draupnir_for_all_enabled else []) + @@ -352,9 +352,9 @@ devture_systemd_service_manager_services_list_auto: | ([{ 'name': 'matrix-appservice-discord.service', 'priority': 2000, - 'restart_necessary': (matrix_appservice_discord_restart_necessary | bool), + 'restart_necessary': (matrix_bridge_appservice_discord_restart_necessary | bool), 'groups': ['matrix', 'bridges', 'appservice-discord'], - }] if matrix_appservice_discord_enabled else []) + }] if matrix_bridge_appservice_discord_enabled else []) + ([{ 'name': 'matrix-appservice-draupnir-for-all.service', @@ -1173,42 +1173,42 @@ matrix_authentication_service_syn2mas_synapse_database_socket_path_host: "{{ mat ###################################################################### # We don't enable bridges by default. -matrix_appservice_discord_enabled: false +matrix_bridge_appservice_discord_enabled: false -matrix_appservice_discord_systemd_required_services_list_auto: | +matrix_bridge_appservice_discord_systemd_required_services_list_auto: | {{ matrix_addons_homeserver_systemd_services_list + - ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_appservice_discord_database_hostname == postgres_connection_hostname) else []) + ([postgres_identifier ~ '.service'] if (postgres_enabled and matrix_bridge_appservice_discord_database_hostname == postgres_connection_hostname) else []) }} -matrix_appservice_discord_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_appservice_discord_container_image_registry_prefix_upstream_default }}" +matrix_bridge_appservice_discord_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bridge_appservice_discord_container_image_registry_prefix_upstream_default }}" -matrix_appservice_discord_container_http_host_bind_port: "{{ (matrix_playbook_service_host_bind_interface_prefix ~ '9005') if matrix_playbook_service_host_bind_interface_prefix else '' }}" +matrix_bridge_appservice_discord_container_http_host_bind_port: "{{ (matrix_playbook_service_host_bind_interface_prefix ~ '9005') if matrix_playbook_service_host_bind_interface_prefix else '' }}" -matrix_appservice_discord_container_network: "{{ matrix_addons_container_network }}" +matrix_bridge_appservice_discord_container_network: "{{ matrix_addons_container_network }}" -matrix_appservice_discord_container_additional_networks_auto: |- +matrix_bridge_appservice_discord_container_additional_networks_auto: |- {{ ( ([] if matrix_addons_homeserver_container_network == '' else [matrix_addons_homeserver_container_network]) + - ([postgres_container_network] if (postgres_enabled and matrix_appservice_discord_database_hostname == postgres_connection_hostname and matrix_appservice_discord_container_network != postgres_container_network) else []) + ([postgres_container_network] if (postgres_enabled and matrix_bridge_appservice_discord_database_hostname == postgres_connection_hostname and matrix_bridge_appservice_discord_container_network != postgres_container_network) else []) ) | unique }} # If the homeserver disables presence, it's likely better (less wasteful) to also disable presence on the bridge side. -matrix_appservice_discord_bridge_disablePresence: "{{ (not matrix_synapse_presence_enabled) if matrix_homeserver_implementation == 'synapse' else false }}" +matrix_bridge_appservice_discord_bridge_disablePresence: "{{ (not matrix_synapse_presence_enabled) if matrix_homeserver_implementation == 'synapse' else false }}" -matrix_appservice_discord_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':discord.as.token') | hash('sha512') | to_uuid }}" +matrix_bridge_appservice_discord_appservice_token: "{{ (matrix_homeserver_generic_secret_key + ':discord.as.token') | hash('sha512') | to_uuid }}" -matrix_appservice_discord_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':discord.hs.token') | hash('sha512') | to_uuid }}" +matrix_bridge_appservice_discord_homeserver_token: "{{ (matrix_homeserver_generic_secret_key + ':discord.hs.token') | hash('sha512') | to_uuid }}" # We only make this use Postgres if our own Postgres server is enabled. # It's only then (for now) that we can automatically create the necessary database and user for this service. -matrix_appservice_discord_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}" -matrix_appservice_discord_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" -matrix_appservice_discord_database_password: "{{ (matrix_homeserver_generic_secret_key + ':as.discord.db') | hash('sha512') | to_uuid }}" +matrix_bridge_appservice_discord_database_engine: "{{ 'postgres' if postgres_enabled else 'sqlite' }}" +matrix_bridge_appservice_discord_database_hostname: "{{ postgres_connection_hostname if postgres_enabled else '' }}" +matrix_bridge_appservice_discord_database_password: "{{ (matrix_homeserver_generic_secret_key + ':as.discord.db') | hash('sha512') | to_uuid }}" ###################################################################### # @@ -4141,10 +4141,10 @@ postgres_managed_databases_auto: | }] if (matrix_bot_buscarron_enabled and matrix_bot_buscarron_database_engine == 'postgres' and matrix_bot_buscarron_database_hostname == postgres_connection_hostname) else []) + ([{ - 'name': matrix_appservice_discord_database_name, - 'username': matrix_appservice_discord_database_username, - 'password': matrix_appservice_discord_database_password, - }] if (matrix_appservice_discord_enabled and matrix_appservice_discord_database_engine == 'postgres' and matrix_appservice_discord_database_hostname == postgres_connection_hostname) else []) + 'name': matrix_bridge_appservice_discord_database_name, + 'username': matrix_bridge_appservice_discord_database_username, + 'password': matrix_bridge_appservice_discord_database_password, + }] if (matrix_bridge_appservice_discord_enabled and matrix_bridge_appservice_discord_database_engine == 'postgres' and matrix_bridge_appservice_discord_database_hostname == postgres_connection_hostname) else []) + ([{ 'name': matrix_appservice_draupnir_for_all_database_name, @@ -5100,7 +5100,7 @@ matrix_ketesa_config_asManagedUsers_auto: | + ([ '^@_discord_[a-zA-Z0-9]+:'+(matrix_domain | regex_escape)+'$', - ] if matrix_appservice_discord_enabled else []) + ] if matrix_bridge_appservice_discord_enabled else []) + ([ '^@'+(matrix_beeper_linkedin_appservice_bot_username | default('') | regex_escape)+':'+(matrix_domain | regex_escape)+'$', diff --git a/roles/custom/matrix-bridge-appservice-discord/defaults/main.yml b/roles/custom/matrix-bridge-appservice-discord/defaults/main.yml index 4a246204b..440a7f409 100644 --- a/roles/custom/matrix-bridge-appservice-discord/defaults/main.yml +++ b/roles/custom/matrix-bridge-appservice-discord/defaults/main.yml @@ -15,82 +15,82 @@ # matrix-appservice-discord is a Matrix <-> Discord bridge # Project source code URL: https://github.com/matrix-org/matrix-appservice-discord -matrix_appservice_discord_enabled: false +matrix_bridge_appservice_discord_enabled: false # renovate: datasource=docker depName=ghcr.io/matrix-org/matrix-appservice-discord -matrix_appservice_discord_version: v4.0.0 -matrix_appservice_discord_container_image: "{{ matrix_appservice_discord_container_image_registry_prefix }}matrix-org/matrix-appservice-discord:{{ matrix_appservice_discord_version }}" -matrix_appservice_discord_container_image_registry_prefix: "{{ matrix_appservice_discord_container_image_registry_prefix_upstream }}" -matrix_appservice_discord_container_image_registry_prefix_upstream: "{{ matrix_appservice_discord_container_image_registry_prefix_upstream_default }}" -matrix_appservice_discord_container_image_registry_prefix_upstream_default: "ghcr.io/" +matrix_bridge_appservice_discord_version: v4.0.0 +matrix_bridge_appservice_discord_container_image: "{{ matrix_bridge_appservice_discord_container_image_registry_prefix }}matrix-org/matrix-appservice-discord:{{ matrix_bridge_appservice_discord_version }}" +matrix_bridge_appservice_discord_container_image_registry_prefix: "{{ matrix_bridge_appservice_discord_container_image_registry_prefix_upstream }}" +matrix_bridge_appservice_discord_container_image_registry_prefix_upstream: "{{ matrix_bridge_appservice_discord_container_image_registry_prefix_upstream_default }}" +matrix_bridge_appservice_discord_container_image_registry_prefix_upstream_default: "ghcr.io/" -matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord" -matrix_appservice_discord_config_path: "{{ matrix_base_data_path }}/appservice-discord/config" -matrix_appservice_discord_data_path: "{{ matrix_base_data_path }}/appservice-discord/data" +matrix_bridge_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord" +matrix_bridge_appservice_discord_config_path: "{{ matrix_base_data_path }}/appservice-discord/config" +matrix_bridge_appservice_discord_data_path: "{{ matrix_base_data_path }}/appservice-discord/data" # Get your own keys at https://discordapp.com/developers/applications/me/create -matrix_appservice_discord_client_id: '' -matrix_appservice_discord_bot_token: '' +matrix_bridge_appservice_discord_client_id: '' +matrix_bridge_appservice_discord_bot_token: '' -matrix_appservice_discord_appservice_token: '' -matrix_appservice_discord_homeserver_token: '' +matrix_bridge_appservice_discord_appservice_token: '' +matrix_bridge_appservice_discord_homeserver_token: '' -matrix_appservice_discord_homeserver_domain: "{{ matrix_domain }}" +matrix_bridge_appservice_discord_homeserver_domain: "{{ matrix_domain }}" # Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9005 in the container). # # Takes an ":" or "" value (e.g. "127.0.0.1:9005"), or empty string to not expose. -matrix_appservice_discord_container_http_host_bind_port: '' +matrix_bridge_appservice_discord_container_http_host_bind_port: '' -matrix_appservice_discord_container_network: "" +matrix_bridge_appservice_discord_container_network: "" -matrix_appservice_discord_container_additional_networks: "{{ matrix_appservice_discord_container_additional_networks_auto + matrix_appservice_discord_container_additional_networks_custom }}" -matrix_appservice_discord_container_additional_networks_auto: [] -matrix_appservice_discord_container_additional_networks_custom: [] +matrix_bridge_appservice_discord_container_additional_networks: "{{ matrix_bridge_appservice_discord_container_additional_networks_auto + matrix_bridge_appservice_discord_container_additional_networks_custom }}" +matrix_bridge_appservice_discord_container_additional_networks_auto: [] +matrix_bridge_appservice_discord_container_additional_networks_custom: [] # A list of extra arguments to pass to the container -matrix_appservice_discord_container_extra_arguments: [] +matrix_bridge_appservice_discord_container_extra_arguments: [] # List of systemd services that matrix-appservice-discord.service depends on. -matrix_appservice_discord_systemd_required_services_list: "{{ matrix_appservice_discord_systemd_required_services_list_default + matrix_appservice_discord_systemd_required_services_list_auto + matrix_appservice_discord_systemd_required_services_list_custom }}" -matrix_appservice_discord_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" -matrix_appservice_discord_systemd_required_services_list_auto: [] -matrix_appservice_discord_systemd_required_services_list_custom: [] +matrix_bridge_appservice_discord_systemd_required_services_list: "{{ matrix_bridge_appservice_discord_systemd_required_services_list_default + matrix_bridge_appservice_discord_systemd_required_services_list_auto + matrix_bridge_appservice_discord_systemd_required_services_list_custom }}" +matrix_bridge_appservice_discord_systemd_required_services_list_default: "{{ [devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [] }}" +matrix_bridge_appservice_discord_systemd_required_services_list_auto: [] +matrix_bridge_appservice_discord_systemd_required_services_list_custom: [] # List of systemd services that matrix-appservice-discord.service wants -matrix_appservice_discord_systemd_wanted_services_list: [] +matrix_bridge_appservice_discord_systemd_wanted_services_list: [] -matrix_appservice_discord_appservice_url: 'http://matrix-appservice-discord:9005' +matrix_bridge_appservice_discord_appservice_url: 'http://matrix-appservice-discord:9005' -matrix_appservice_discord_bridge_domain: "{{ matrix_domain }}" +matrix_bridge_appservice_discord_bridge_domain: "{{ matrix_domain }}" # As of right now, the homeserver URL must be a public URL. See below. -matrix_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}" # noqa var-naming -matrix_appservice_discord_bridge_disablePresence: false # noqa var-naming -matrix_appservice_discord_bridge_enableSelfServiceBridging: false # noqa var-naming -matrix_appservice_discord_bridge_disablePortalBridging: false # noqa var-naming +matrix_bridge_appservice_discord_bridge_homeserverUrl: "{{ matrix_homeserver_url }}" # noqa var-naming +matrix_bridge_appservice_discord_bridge_disablePresence: false # noqa var-naming +matrix_bridge_appservice_discord_bridge_enableSelfServiceBridging: false # noqa var-naming +matrix_bridge_appservice_discord_bridge_disablePortalBridging: false # noqa var-naming # Database-related configuration fields. # # To use SQLite, stick to these defaults. # # To use Postgres: -# - change the engine (`matrix_appservice_discord_database_engine: 'postgres'`) -# - adjust your database credentials via the `matrix_appservice_discord_database_*` variables -matrix_appservice_discord_database_engine: 'sqlite' +# - change the engine (`matrix_bridge_appservice_discord_database_engine: 'postgres'`) +# - adjust your database credentials via the `matrix_bridge_appservice_discord_database_*` variables +matrix_bridge_appservice_discord_database_engine: 'sqlite' -matrix_appservice_discord_sqlite_database_path_local: "{{ matrix_appservice_discord_data_path }}/discord.db" -matrix_appservice_discord_sqlite_database_path_in_container: "/data/discord.db" +matrix_bridge_appservice_discord_sqlite_database_path_local: "{{ matrix_bridge_appservice_discord_data_path }}/discord.db" +matrix_bridge_appservice_discord_sqlite_database_path_in_container: "/data/discord.db" -matrix_appservice_discord_database_username: 'matrix_appservice_discord' -matrix_appservice_discord_database_password: 'some-password' -matrix_appservice_discord_database_hostname: '' -matrix_appservice_discord_database_port: 5432 -matrix_appservice_discord_database_name: 'matrix_appservice_discord' +matrix_bridge_appservice_discord_database_username: 'matrix_appservice_discord' +matrix_bridge_appservice_discord_database_password: 'some-password' +matrix_bridge_appservice_discord_database_hostname: '' +matrix_bridge_appservice_discord_database_port: 5432 +matrix_bridge_appservice_discord_database_name: 'matrix_appservice_discord' # These 2 variables are what actually ends up in the bridge configuration. # It's best if you don't change them directly, but rather redefine the sub-variables that constitute them. -matrix_appservice_discord_database_filename: "{{ matrix_appservice_discord_sqlite_database_path_in_container }}" -matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservice_discord_database_username }}:{{ matrix_appservice_discord_database_password }}@{{ matrix_appservice_discord_database_hostname }}:{{ matrix_appservice_discord_database_port }}/{{ matrix_appservice_discord_database_name }}' # noqa var-naming +matrix_bridge_appservice_discord_database_filename: "{{ matrix_bridge_appservice_discord_sqlite_database_path_in_container }}" +matrix_bridge_appservice_discord_database_connString: 'postgresql://{{ matrix_bridge_appservice_discord_database_username }}:{{ matrix_bridge_appservice_discord_database_password }}@{{ matrix_bridge_appservice_discord_database_hostname }}:{{ matrix_bridge_appservice_discord_database_port }}/{{ matrix_bridge_appservice_discord_database_name }}' # noqa var-naming # Tells whether the bot should make use of "Privileged Gateway Intents". @@ -99,44 +99,44 @@ matrix_appservice_discord_database_connString: 'postgresql://{{ matrix_appservic # by triggering all Intent checkboxes on a page like this: `https://discord.com/developers/applications/694448564151123988/bot` # # Learn more: https://gist.github.com/advaith1/e69bcc1cdd6d0087322734451f15aa2f -matrix_appservice_discord_auth_usePrivilegedIntents: false # noqa var-naming +matrix_bridge_appservice_discord_auth_usePrivilegedIntents: false # noqa var-naming -matrix_appservice_discord_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" +matrix_bridge_appservice_discord_configuration_yaml: "{{ lookup('template', 'templates/config.yaml.j2') }}" -matrix_appservice_discord_configuration_extension_yaml: | +matrix_bridge_appservice_discord_configuration_extension_yaml: | # Your custom YAML configuration goes here. - # This configuration extends the default starting configuration (`matrix_appservice_discord_configuration_yaml`). + # This configuration extends the default starting configuration (`matrix_bridge_appservice_discord_configuration_yaml`). # # 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 - # completely redefining `matrix_appservice_discord_configuration_yaml`. + # completely redefining `matrix_bridge_appservice_discord_configuration_yaml`. -matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml | from_yaml if matrix_appservice_discord_configuration_extension_yaml | from_yaml is mapping else {} }}" +matrix_bridge_appservice_discord_configuration_extension: "{{ matrix_bridge_appservice_discord_configuration_extension_yaml | from_yaml if matrix_bridge_appservice_discord_configuration_extension_yaml | from_yaml is mapping else {} }}" -matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml | from_yaml | combine(matrix_appservice_discord_configuration_extension, recursive=True) }}" +matrix_bridge_appservice_discord_configuration: "{{ matrix_bridge_appservice_discord_configuration_yaml | from_yaml | combine(matrix_bridge_appservice_discord_configuration_extension, recursive=True) }}" -matrix_appservice_discord_registration_yaml: | +matrix_bridge_appservice_discord_registration_yaml: | #jinja2: lstrip_blocks: True id: appservice-discord - as_token: "{{ matrix_appservice_discord_appservice_token }}" - hs_token: "{{ matrix_appservice_discord_homeserver_token }}" + as_token: "{{ matrix_bridge_appservice_discord_appservice_token }}" + hs_token: "{{ matrix_bridge_appservice_discord_homeserver_token }}" namespaces: users: - exclusive: true - regex: '@_discord_.*:{{ matrix_appservice_discord_homeserver_domain | regex_escape }}' + regex: '@_discord_.*:{{ matrix_bridge_appservice_discord_homeserver_domain | regex_escape }}' aliases: - exclusive: true - regex: '#_discord_.*:{{ matrix_appservice_discord_homeserver_domain | regex_escape }}' - url: {{ matrix_appservice_discord_appservice_url }} + regex: '#_discord_.*:{{ matrix_bridge_appservice_discord_homeserver_domain | regex_escape }}' + url: {{ matrix_bridge_appservice_discord_appservice_url }} sender_localpart: _discord_bot rate_limited: false protocols: - discord -matrix_appservice_discord_registration: "{{ matrix_appservice_discord_registration_yaml | from_yaml }}" +matrix_bridge_appservice_discord_registration: "{{ matrix_bridge_appservice_discord_registration_yaml | from_yaml }}" -# matrix_appservice_discord_restart_necessary controls whether the service +# matrix_bridge_appservice_discord_restart_necessary controls whether the service # will be restarted (when true) or merely started (when false) by the # systemd service manager role (when conditional restart is enabled). # @@ -144,4 +144,4 @@ matrix_appservice_discord_registration: "{{ matrix_appservice_discord_registrati # 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 # installation tasks haven't run (e.g., due to --tags skipping them). -matrix_appservice_discord_restart_necessary: false +matrix_bridge_appservice_discord_restart_necessary: false diff --git a/roles/custom/matrix-bridge-appservice-discord/tasks/main.yml b/roles/custom/matrix-bridge-appservice-discord/tasks/main.yml index 617a70849..8a2992b64 100644 --- a/roles/custom/matrix-bridge-appservice-discord/tasks/main.yml +++ b/roles/custom/matrix-bridge-appservice-discord/tasks/main.yml @@ -12,15 +12,15 @@ - install-all - install-appservice-discord block: - - when: matrix_appservice_discord_enabled | bool + - when: matrix_bridge_appservice_discord_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml" - - when: matrix_appservice_discord_enabled | bool + - when: matrix_bridge_appservice_discord_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_install.yml" - tags: - setup-all - setup-appservice-discord block: - - when: not matrix_appservice_discord_enabled | bool + - when: not matrix_bridge_appservice_discord_enabled | bool ansible.builtin.include_tasks: "{{ role_path }}/tasks/setup_uninstall.yml" diff --git a/roles/custom/matrix-bridge-appservice-discord/tasks/setup_install.yml b/roles/custom/matrix-bridge-appservice-discord/tasks/setup_install.yml index 6a64c0a8a..810d3bd1b 100644 --- a/roles/custom/matrix-bridge-appservice-discord/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-appservice-discord/tasks/setup_install.yml @@ -14,40 +14,40 @@ --- - ansible.builtin.set_fact: - matrix_appservice_discord_migration_requires_restart: false + matrix_bridge_appservice_discord_migration_requires_restart: false -- when: "matrix_appservice_discord_database_engine == 'postgres'" +- when: "matrix_bridge_appservice_discord_database_engine == 'postgres'" block: - name: Check if an SQLite database already exists ansible.builtin.stat: - path: "{{ matrix_appservice_discord_sqlite_database_path_local }}" - register: matrix_appservice_discord_sqlite_database_path_local_stat_result + path: "{{ matrix_bridge_appservice_discord_sqlite_database_path_local }}" + register: matrix_bridge_appservice_discord_sqlite_database_path_local_stat_result - - when: "matrix_appservice_discord_sqlite_database_path_local_stat_result.stat.exists | bool" + - when: "matrix_bridge_appservice_discord_sqlite_database_path_local_stat_result.stat.exists | bool" block: - ansible.builtin.include_role: name: galaxy/postgres tasks_from: migrate_db_to_postgres vars: postgres_db_migration_request: - src: "{{ matrix_appservice_discord_sqlite_database_path_local }}" - dst: "{{ matrix_appservice_discord_database_connString }}" + src: "{{ matrix_bridge_appservice_discord_sqlite_database_path_local }}" + dst: "{{ matrix_bridge_appservice_discord_database_connString }}" caller: "{{ role_path | basename }}" - engine_variable_name: 'matrix_appservice_discord_database_engine' + engine_variable_name: 'matrix_bridge_appservice_discord_database_engine' engine_old: 'sqlite' systemd_services_to_stop: ['matrix-appservice-discord.service'] - ansible.builtin.set_fact: - matrix_appservice_discord_migration_requires_restart: true + matrix_bridge_appservice_discord_migration_requires_restart: true - name: Ensure Appservice Discord image is pulled community.docker.docker_image_pull: - name: "{{ matrix_appservice_discord_container_image }}" + name: "{{ matrix_bridge_appservice_discord_container_image }}" pull: always - register: matrix_appservice_discord_container_image_pull_result + register: matrix_bridge_appservice_discord_container_image_pull_result retries: "{{ devture_playbook_help_container_retries_count }}" delay: "{{ devture_playbook_help_container_retries_delay }}" - until: matrix_appservice_discord_container_image_pull_result is not failed + until: matrix_bridge_appservice_discord_container_image_pull_result is not failed - name: Ensure AppService Discord paths exist ansible.builtin.file: @@ -57,14 +57,14 @@ owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" with_items: - - "{{ matrix_appservice_discord_base_path }}" - - "{{ matrix_appservice_discord_config_path }}" - - "{{ matrix_appservice_discord_data_path }}" + - "{{ matrix_bridge_appservice_discord_base_path }}" + - "{{ matrix_bridge_appservice_discord_config_path }}" + - "{{ matrix_bridge_appservice_discord_data_path }}" - name: Check if an old database file already exists ansible.builtin.stat: - path: "{{ matrix_appservice_discord_base_path }}/discord.db" - register: matrix_appservice_discord_stat_db + path: "{{ matrix_bridge_appservice_discord_base_path }}/discord.db" + register: matrix_bridge_appservice_discord_stat_db - name: (Data relocation) Ensure matrix-appservice-discord.service is stopped ansible.builtin.service: @@ -73,55 +73,55 @@ enabled: false daemon_reload: true failed_when: false - when: "matrix_appservice_discord_stat_db.stat.exists" + when: "matrix_bridge_appservice_discord_stat_db.stat.exists" - name: (Data relocation) Move AppService Discord discord.db file to ./data directory ansible.builtin.command: - cmd: "mv {{ matrix_appservice_discord_base_path }}/{{ item }} {{ matrix_appservice_discord_data_path }}/{{ item }}" - creates: "{{ matrix_appservice_discord_data_path }}/{{ item }}" - removes: "{{ matrix_appservice_discord_base_path }}/{{ item }}" + cmd: "mv {{ matrix_bridge_appservice_discord_base_path }}/{{ item }} {{ matrix_bridge_appservice_discord_data_path }}/{{ item }}" + creates: "{{ matrix_bridge_appservice_discord_data_path }}/{{ item }}" + removes: "{{ matrix_bridge_appservice_discord_base_path }}/{{ item }}" with_items: - discord.db - user-store.db - room-store.db - when: "matrix_appservice_discord_stat_db.stat.exists" + when: "matrix_bridge_appservice_discord_stat_db.stat.exists" - name: Ensure AppService Discord config.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_discord_configuration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_appservice_discord_config_path }}/config.yaml" + content: "{{ matrix_bridge_appservice_discord_configuration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_bridge_appservice_discord_config_path }}/config.yaml" mode: '0644' owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" - register: matrix_appservice_discord_config_result + register: matrix_bridge_appservice_discord_config_result - name: Ensure AppService Discord registration.yaml installed ansible.builtin.copy: - content: "{{ matrix_appservice_discord_registration | to_nice_yaml(indent=2, width=999999) }}" - dest: "{{ matrix_appservice_discord_config_path }}/registration.yaml" + content: "{{ matrix_bridge_appservice_discord_registration | to_nice_yaml(indent=2, width=999999) }}" + dest: "{{ matrix_bridge_appservice_discord_config_path }}/registration.yaml" mode: '0644' owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" - register: matrix_appservice_discord_registration_result + register: matrix_bridge_appservice_discord_registration_result -# If `matrix_appservice_discord_client_id` hasn't changed, the same invite link would be generated. +# If `matrix_bridge_appservice_discord_client_id` hasn't changed, the same invite link would be generated. # We intentionally suppress Ansible changes. - name: Generate AppService Discord invite link ansible.builtin.shell: >- {{ devture_systemd_docker_base_host_command_docker }} run --rm --name matrix-appservice-discord-link-gen --user={{ matrix_user_uid }}:{{ matrix_user_gid }} --cap-drop=ALL - --mount type=bind,src={{ matrix_appservice_discord_config_path }},dst=/cfg + --mount type=bind,src={{ matrix_bridge_appservice_discord_config_path }},dst=/cfg -w /cfg - {{ matrix_appservice_discord_container_image }} + {{ matrix_bridge_appservice_discord_container_image }} /bin/sh -c "node /build/tools/addbot.js > /cfg/invite_link" changed_when: false - name: Ensure matrix-appservice-discord container network is created - when: matrix_appservice_discord_container_network != 'host' + when: matrix_bridge_appservice_discord_container_network != 'host' community.general.docker_network: enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}" - name: "{{ matrix_appservice_discord_container_network }}" + name: "{{ matrix_bridge_appservice_discord_container_network }}" driver: bridge driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}" @@ -130,17 +130,17 @@ src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2" dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-discord.service" mode: '0644' - register: matrix_appservice_discord_systemd_service_result + register: matrix_bridge_appservice_discord_systemd_service_result - name: Determine whether matrix-appservice-discord needs a restart ansible.builtin.set_fact: - matrix_appservice_discord_restart_necessary: >- + matrix_bridge_appservice_discord_restart_necessary: >- {{ - matrix_appservice_discord_migration_requires_restart | default(false) - or matrix_appservice_discord_config_result.changed | default(false) - or matrix_appservice_discord_registration_result.changed | default(false) - or matrix_appservice_discord_systemd_service_result.changed | default(false) - or matrix_appservice_discord_container_image_pull_result.changed | default(false) + matrix_bridge_appservice_discord_migration_requires_restart | default(false) + or matrix_bridge_appservice_discord_config_result.changed | default(false) + or matrix_bridge_appservice_discord_registration_result.changed | default(false) + or matrix_bridge_appservice_discord_systemd_service_result.changed | default(false) + or matrix_bridge_appservice_discord_container_image_pull_result.changed | default(false) }} - name: Ensure matrix-appservice-discord.service restarted, if necessary @@ -148,4 +148,4 @@ name: "matrix-appservice-discord.service" state: restarted daemon_reload: true - when: "matrix_appservice_discord_migration_requires_restart | bool" + when: "matrix_bridge_appservice_discord_migration_requires_restart | bool" diff --git a/roles/custom/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml b/roles/custom/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml index fb164945c..68473e80a 100644 --- a/roles/custom/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml +++ b/roles/custom/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml @@ -9,9 +9,9 @@ - name: Check existence of matrix-appservice-discord service ansible.builtin.stat: path: "{{ devture_systemd_docker_base_systemd_path }}/matrix-appservice-discord.service" - register: matrix_appservice_discord_service_stat + register: matrix_bridge_appservice_discord_service_stat -- when: matrix_appservice_discord_service_stat.stat.exists | bool +- when: matrix_bridge_appservice_discord_service_stat.stat.exists | bool block: - name: Ensure matrix-appservice-discord is stopped ansible.builtin.service: diff --git a/roles/custom/matrix-bridge-appservice-discord/tasks/validate_config.yml b/roles/custom/matrix-bridge-appservice-discord/tasks/validate_config.yml index b1abb0f47..3d3bd4876 100644 --- a/roles/custom/matrix-bridge-appservice-discord/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-appservice-discord/tasks/validate_config.yml @@ -12,15 +12,15 @@ Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml). when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" with_items: - - {'old': 'matrix_appservice_discord_container_expose_client_server_api_port', 'new': ''} - - {'old': 'matrix_appservice_discord_container_image_name_prefix', 'new': 'matrix_appservice_discord_container_image_registry_prefix'} - - {'old': 'matrix_appservice_discord_docker_image', 'new': 'matrix_appservice_discord_container_image'} - - {'old': 'matrix_appservice_discord_docker_image_force_pull', 'new': 'matrix_appservice_discord_container_image_force_pull'} - - {'old': 'matrix_appservice_discord_docker_image_registry_prefix', 'new': 'matrix_appservice_discord_container_image_registry_prefix'} - - {'old': 'matrix_appservice_discord_docker_image_registry_prefix_upstream', 'new': 'matrix_appservice_discord_container_image_registry_prefix_upstream'} - - {'old': 'matrix_appservice_discord_docker_image_registry_prefix_upstream_default', 'new': 'matrix_appservice_discord_container_image_registry_prefix_upstream_default'} - - {'old': 'matrix_appservice_discord_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} - - {'old': 'matrix_appservice_discord_container_image_self_build', 'new': ' (self-building was never actually implemented for this role, so enabling it only led to image pull failures; the prebuilt image is amd64-only, so on other architectures consider the mautrix-discord bridge instead)'} + - {'old': 'matrix_bridge_appservice_discord_container_expose_client_server_api_port', 'new': ''} + - {'old': 'matrix_bridge_appservice_discord_container_image_name_prefix', 'new': 'matrix_bridge_appservice_discord_container_image_registry_prefix'} + - {'old': 'matrix_bridge_appservice_discord_docker_image', 'new': 'matrix_bridge_appservice_discord_container_image'} + - {'old': 'matrix_bridge_appservice_discord_docker_image_force_pull', 'new': 'matrix_bridge_appservice_discord_container_image_force_pull'} + - {'old': 'matrix_bridge_appservice_discord_docker_image_registry_prefix', 'new': 'matrix_bridge_appservice_discord_container_image_registry_prefix'} + - {'old': 'matrix_bridge_appservice_discord_docker_image_registry_prefix_upstream', 'new': 'matrix_bridge_appservice_discord_container_image_registry_prefix_upstream'} + - {'old': 'matrix_bridge_appservice_discord_docker_image_registry_prefix_upstream_default', 'new': 'matrix_bridge_appservice_discord_container_image_registry_prefix_upstream_default'} + - {'old': 'matrix_bridge_appservice_discord_container_image_force_pull', 'new': ' (the new community.docker.docker_image_pull module handles this natively)'} + - {'old': 'matrix_bridge_appservice_discord_container_image_self_build', 'new': ' (self-building was never actually implemented for this role, so enabling it only led to image pull failures; the prebuilt image is amd64-only, so on other architectures consider the mautrix-discord bridge instead)'} - name: Fail if required appservice-discord settings not defined ansible.builtin.fail: @@ -28,15 +28,15 @@ You need to define a required configuration setting (`{{ item.name }}`). when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - - {'name': 'matrix_appservice_discord_client_id', when: true} - - {'name': 'matrix_appservice_discord_bot_token', when: true} - - {'name': 'matrix_appservice_discord_appservice_token', when: true} - - {'name': 'matrix_appservice_discord_homeserver_token', when: true} - - {'name': 'matrix_appservice_discord_homeserver_domain', when: true} - - {'name': 'matrix_appservice_discord_container_network', when: true} - - {'name': 'matrix_appservice_discord_database_hostname', when: "{{ matrix_appservice_discord_database_engine == 'postgres' }}"} + - {'name': 'matrix_bridge_appservice_discord_client_id', when: true} + - {'name': 'matrix_bridge_appservice_discord_bot_token', when: true} + - {'name': 'matrix_bridge_appservice_discord_appservice_token', when: true} + - {'name': 'matrix_bridge_appservice_discord_homeserver_token', when: true} + - {'name': 'matrix_bridge_appservice_discord_homeserver_domain', when: true} + - {'name': 'matrix_bridge_appservice_discord_container_network', when: true} + - {'name': 'matrix_bridge_appservice_discord_database_hostname', when: "{{ matrix_bridge_appservice_discord_database_engine == 'postgres' }}"} - name: Require a valid database engine ansible.builtin.fail: - msg: "`matrix_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'" - when: "matrix_appservice_discord_database_engine not in ['sqlite', 'postgres']" + msg: "`matrix_bridge_appservice_discord_database_engine` needs to be either 'sqlite' or 'postgres'" + when: "matrix_bridge_appservice_discord_database_engine not in ['sqlite', 'postgres']" diff --git a/roles/custom/matrix-bridge-appservice-discord/templates/config.yaml.j2 b/roles/custom/matrix-bridge-appservice-discord/templates/config.yaml.j2 index 63c45d020..138039cfd 100644 --- a/roles/custom/matrix-bridge-appservice-discord/templates/config.yaml.j2 +++ b/roles/custom/matrix-bridge-appservice-discord/templates/config.yaml.j2 @@ -1,10 +1,10 @@ #jinja2: lstrip_blocks: True bridge: # Domain part of the bridge, e.g. matrix.org - domain: {{ matrix_appservice_discord_bridge_domain|to_json }} + domain: {{ matrix_bridge_appservice_discord_bridge_domain|to_json }} # This should be your publicly facing URL because Discord may use it to # fetch media from the media store. - homeserverUrl: {{ matrix_appservice_discord_bridge_homeserverUrl|to_json }} + homeserverUrl: {{ matrix_bridge_appservice_discord_bridge_homeserverUrl|to_json }} # Interval at which to process users in the 'presence queue'. If you have # 5 users, one user will be processed every 500 milliseconds according to the # value below. This has a minimum value of 250. @@ -13,17 +13,17 @@ bridge: presenceInterval: 500 # Disable setting presence for 'ghost users' which means Discord users on Matrix # will not be shown as away or online. - disablePresence: {{ matrix_appservice_discord_bridge_disablePresence|to_json }} + disablePresence: {{ matrix_bridge_appservice_discord_bridge_disablePresence|to_json }} # Disable sending typing notifications when somebody on Discord types. disableTypingNotifications: false # Disable deleting messages on Discord if a message is redacted on Matrix. disableDeletionForwarding: false # Disable portal bridging, where Matrix users can search for unbridged Discord # rooms on their Matrix server. - disablePortalBridging: {{ matrix_appservice_discord_bridge_disablePortalBridging|to_json }} + disablePortalBridging: {{ matrix_bridge_appservice_discord_bridge_disablePortalBridging|to_json }} # Enable users to bridge rooms using !discord commands. See # https://t2bot.io/discord for instructions. - enableSelfServiceBridging: {{ matrix_appservice_discord_bridge_enableSelfServiceBridging|to_json }} + enableSelfServiceBridging: {{ matrix_bridge_appservice_discord_bridge_enableSelfServiceBridging|to_json }} # Disable sending of read receipts for Matrix events which have been # successfully bridged to Discord. disableReadReceipts: false @@ -41,11 +41,11 @@ bridge: invalidTokenMessage: 'Your Discord bot token seems to be invalid, and the bridge cannot function. Please update it in your bridge settings and restart the bridge' # Authentication configuration for the discord bot. auth: - clientID: {{ matrix_appservice_discord_client_id | string|to_json }} - botToken: {{ matrix_appservice_discord_bot_token|to_json }} + clientID: {{ matrix_bridge_appservice_discord_client_id | string|to_json }} + botToken: {{ matrix_bridge_appservice_discord_bot_token|to_json }} # You must enable "Privileged Gateway Intents" in your bot settings on discord.com (e.g. https://discord.com/developers/applications/12345/bot) # for this to work - usePrivilegedIntents: {{ matrix_appservice_discord_auth_usePrivilegedIntents|to_json }} + usePrivilegedIntents: {{ matrix_bridge_appservice_discord_auth_usePrivilegedIntents|to_json }} logging: # What level should the logger output to the console at. console: "warn" # Valid values: silent, error, warn, http, info, verbose, silly @@ -67,10 +67,10 @@ database: # If you are migrating, see https://github.com/matrix-org/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite # WARNING: You will almost certainly be fine with sqlite unless your bridge # is in heavy demand and you suffer from IO slowness. - {% if matrix_appservice_discord_database_engine == 'sqlite' %} - filename: {{ matrix_appservice_discord_database_filename|to_json }} + {% if matrix_bridge_appservice_discord_database_engine == 'sqlite' %} + filename: {{ matrix_bridge_appservice_discord_database_filename|to_json }} {% else %} - connString: {{ matrix_appservice_discord_database_connString|to_json }} + connString: {{ matrix_bridge_appservice_discord_database_connString|to_json }} {% endif %} room: # Set the default visibility of alias rooms, defaults to "public". diff --git a/roles/custom/matrix-bridge-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 b/roles/custom/matrix-bridge-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 index 54c66065a..0d7beae30 100644 --- a/roles/custom/matrix-bridge-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 +++ b/roles/custom/matrix-bridge-appservice-discord/templates/systemd/matrix-appservice-discord.service.j2 @@ -1,11 +1,11 @@ #jinja2: lstrip_blocks: True [Unit] Description=Matrix Appservice Discord bridge -{% for service in matrix_appservice_discord_systemd_required_services_list %} +{% for service in matrix_bridge_appservice_discord_systemd_required_services_list %} Requires={{ service }} After={{ service }} {% endfor %} -{% for service in matrix_appservice_discord_systemd_wanted_services_list %} +{% for service in matrix_bridge_appservice_discord_systemd_wanted_services_list %} Wants={{ service }} {% endfor %} DefaultDependencies=no @@ -22,20 +22,20 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ --log-driver=none \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ - --network={{ matrix_appservice_discord_container_network }} \ - {% if matrix_appservice_discord_container_http_host_bind_port %} - -p {{ matrix_appservice_discord_container_http_host_bind_port }}:9005 \ + --network={{ matrix_bridge_appservice_discord_container_network }} \ + {% if matrix_bridge_appservice_discord_container_http_host_bind_port %} + -p {{ matrix_bridge_appservice_discord_container_http_host_bind_port }}:9005 \ {% endif %} - --mount type=bind,src={{ matrix_appservice_discord_config_path }},dst=/cfg \ - --mount type=bind,src={{ matrix_appservice_discord_data_path }},dst=/data \ - {% for arg in matrix_appservice_discord_container_extra_arguments %} + --mount type=bind,src={{ matrix_bridge_appservice_discord_config_path }},dst=/cfg \ + --mount type=bind,src={{ matrix_bridge_appservice_discord_data_path }},dst=/data \ + {% for arg in matrix_bridge_appservice_discord_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_appservice_discord_container_image }} \ + {{ matrix_bridge_appservice_discord_container_image }} \ node /build/src/discordas.js -p 9005 -c /cfg/config.yaml -f /cfg/registration.yaml -{% if matrix_appservice_discord_container_network != 'host' %} -{% for network in matrix_appservice_discord_container_additional_networks %} +{% if matrix_bridge_appservice_discord_container_network != 'host' %} +{% for network in matrix_bridge_appservice_discord_container_additional_networks %} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-appservice-discord {% endfor %} {% endif %}