5
0
mirror of https://github.com/spantaleev/matrix-docker-ansible-deploy.git synced 2026-07-17 15:26:41 +00:00

Rename matrix_appservice_discord_* variables to matrix_bridge_appservice_discord_*

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 14:46:24 +03:00
parent d9bee18ddd
commit dc16f09e78
9 changed files with 176 additions and 176 deletions
@@ -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 "<ip>:<port>" or "<port>" 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
@@ -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"
@@ -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"
@@ -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:
@@ -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': '<superseded by matrix_appservice_discord_container_http_host_bind_port>'}
- {'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': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
- {'old': 'matrix_appservice_discord_container_image_self_build', 'new': '<removed> (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': '<superseded by matrix_bridge_appservice_discord_container_http_host_bind_port>'}
- {'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': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}
- {'old': 'matrix_bridge_appservice_discord_container_image_self_build', 'new': '<removed> (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']"
@@ -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".
@@ -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 %}