2025-03-05 00:26:05 +09:00
# SPDX-FileCopyrightText: 2023 - 2025 MDAD project contributors
2025-03-13 19:25:30 +01:00
# SPDX-FileCopyrightText: 2023 - 2025 Catalan Lover <catalanlover@protonmail.com>
2025-03-05 00:26:05 +09:00
# SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
2023-02-08 16:44:12 +01:00
---
2025-03-13 19:25:30 +01:00
- name : (Deprecation) Catch and report renamed Draupnir settings
ansible.builtin.fail :
msg : >-
Your configuration contains a variable, which now has a different name.
Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
2025-07-26 17:49:52 +03:00
when : "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
2025-03-13 19:25:30 +01:00
with_items :
- {'old': 'matrix_bot_draupnir_container_image_name_prefix', 'new' : 'matrix_bot_draupnir_container_image_registry_prefix' }
- {'old': 'matrix_bot_draupnir_enable_room_state_backing_store', 'new' : 'matrix_bot_draupnir_config_roomStateBackingStore_enabled' }
- {'old': 'matrix_bot_draupnir_disable_server_acl', 'new' : 'matrix_bot_draupnir_config_disableServerACL' }
- {'old': 'matrix_bot_draupnir_enable_experimental_rust_crypto', 'new' : 'matrix_bot_draupnir_config_experimentalRustCrypto' }
- {'old': 'matrix_bot_draupnir_access_token', 'new' : 'matrix_bot_draupnir_config_accessToken' }
- {'old': 'matrix_bot_draupnir_management_room', 'new' : 'matrix_bot_draupnir_config_managementRoom' }
- {'old': 'matrix_bot_draupnir_homeserver_url', 'new' : 'matrix_bot_draupnir_config_homeserverUrl' }
- {'old': 'matrix_bot_draupnir_raw_homeserver_url', 'new' : 'matrix_bot_draupnir_config_rawHomeserverUrl' }
- {'old': 'matrix_bot_draupnir_web_enabled', 'new' : 'matrix_bot_draupnir_config_web_enabled' }
- {'old': 'matrix_bot_draupnir_abuse_reporting_enabled', 'new' : 'matrix_bot_draupnir_config_web_abuseReporting' }
- {'old': 'matrix_bot_draupnir_display_reports', 'new' : 'matrix_bot_draupnir_config_displayReports' }
2025-04-17 21:47:16 +02:00
- {'old': 'matrix_bot_draupnir_container_labels_traefik_hostname', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_hostname' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_path_regexp', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_path_regexp' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_rule', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_rule' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_priority', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_priority' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_entrypoints', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_entrypoints' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_tls', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_tls' }
- {'old': 'matrix_bot_draupnir_container_labels_traefik_tls_certResolver', 'new' : 'matrix_bot_draupnir_container_labels_web_abuseReporting_traefik_tls_certResolver' }
2025-03-13 19:25:30 +01:00
2024-01-07 09:04:27 +02:00
- name : Fail if required matrix-bot-draupnir variables are undefined
2023-02-08 16:44:12 +01:00
ansible.builtin.fail :
2024-03-24 18:25:19 +02:00
msg : "The `{{ item.name }}` variable must be defined and have a non-null value."
2023-02-08 16:44:12 +01:00
with_items :
2025-03-13 19:25:30 +01:00
- {'name': 'matrix_bot_draupnir_config_accessToken', when : "{{ not matrix_bot_draupnir_pantalaimon_use }}" }
2025-03-14 10:22:18 +01:00
- {'name': 'matrix_bot_draupnir_config_accessToken', when : "{{ matrix_bot_draupnir_config_experimentalRustCrypto }}" }
2025-03-13 19:25:30 +01:00
- {'name': 'matrix_bot_draupnir_config_managementRoom', when : true }
2024-03-24 18:25:19 +02:00
- {'name': 'matrix_bot_draupnir_container_network', when : true }
2025-03-13 19:25:30 +01:00
- {'name': 'matrix_bot_draupnir_config_homeserverUrl', when : true }
- {'name': 'matrix_bot_draupnir_config_rawHomeserverUrl', when : true }
2024-03-24 18:25:19 +02:00
- {'name': 'matrix_bot_draupnir_pantalaimon_username', when : "{{ matrix_bot_draupnir_pantalaimon_use }}" }
- {'name': 'matrix_bot_draupnir_pantalaimon_password', when : "{{ matrix_bot_draupnir_pantalaimon_use }}" }
when : "item.when | bool and (vars[item.name] == '' or vars[item.name] is none)"
2025-03-15 08:14:55 +01:00
- name : Fail if Draupnir room hijacking enabled without enabling the Synapse Admin API
ansible.builtin.fail :
msg : "When matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand is enabled, matrix_bot_draupnir_admin_api_enabled must also be enabled"
when : "matrix_bot_draupnir_config_admin_enableMakeRoomAdminCommand | bool and not matrix_bot_draupnir_admin_api_enabled | bool"
2024-03-24 18:25:19 +02:00
- name : Fail if inappropriate variables are defined
ansible.builtin.fail :
msg : "The `{{ item.name }}` variable must be undefined or have a null value."
with_items :
2025-03-13 19:25:30 +01:00
- {'name': 'matrix_bot_draupnir_config_accessToken', when : "{{ matrix_bot_draupnir_pantalaimon_use }}" }
- {'name': 'matrix_bot_draupnir_config_accessToken', when : "{{ matrix_bot_draupnir_login_native }}" }
2024-03-24 18:25:19 +02:00
when : "item.when | bool and not (vars[item.name] == '' or vars[item.name] is none)"
2025-01-18 20:25:30 +01:00
2025-03-14 14:48:16 +01:00
- name : Fail when matrix_bot_draupnir_config_experimentalRustCrypto is enabled together with matrix_bot_draupnir_pantalaimon_use
ansible.builtin.fail :
msg : >-
Your configuration is trying to enable matrix_bot_draupnir_config_experimentalRustCrypto and matrix_bot_draupnir_pantalaimon_use at the same time.
2025-06-02 22:16:14 +09:00
These settings are mutually incompatible and therefore can't be used at the same time.
2025-03-14 14:48:16 +01:00
when :
- matrix_bot_draupnir_pantalaimon_use
- matrix_bot_draupnir_config_experimentalRustCrypto
2025-01-18 20:25:30 +01:00
- when : "matrix_bot_draupnir_pantalaimon_use == 'true' and matrix_bot_draupnir_pantalaimon_breakage_ignore == 'false'"
block :
- name : Inject warning if Pantalaimon is used together with Draupnir
ansible.builtin.set_fact :
devture_playbook_runtime_messages_list : |
{{
devture_playbook_runtime_messages_list | default([])
+
[
2025-03-14 10:22:18 +01:00
"Note: Draupnir does not support running with Pantalaimon as it would break all workflows that involve answering prompts with reactions. To enable E2EE for Draupnir, it is recommended to use matrix_bot_draupnir_config_experimentalRustCrypto instead. This warning can be disabled by setting matrix_bot_draupnir_pantalaimon_breakage_ignore to true."
2025-01-18 20:25:30 +01:00
]
}}