diff --git a/roles/custom/matrix-authentication-service/tasks/validate_config.yml b/roles/custom/matrix-authentication-service/tasks/validate_config.yml index ee40118a5..95a2badb0 100644 --- a/roles/custom/matrix-authentication-service/tasks/validate_config.yml +++ b/roles/custom/matrix-authentication-service/tasks/validate_config.yml @@ -9,7 +9,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and vars[item.name] | string | length == 0" + when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - {'name': 'matrix_authentication_service_hostname', when: true} - {'name': 'matrix_authentication_service_config_database_username', when: true} diff --git a/roles/custom/matrix-bot-draupnir/tasks/validate_config.yml b/roles/custom/matrix-bot-draupnir/tasks/validate_config.yml index d9c2a698a..0bfec3996 100644 --- a/roles/custom/matrix-bot-draupnir/tasks/validate_config.yml +++ b/roles/custom/matrix-bot-draupnir/tasks/validate_config.yml @@ -44,7 +44,7 @@ - {'name': 'matrix_bot_draupnir_config_rawHomeserverUrl', when: true} - {'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)" + when: "item.when | bool and (lookup('vars', item.name, default='') == '' or lookup('vars', item.name, default='') is none)" - name: Fail if Draupnir room hijacking enabled without enabling the Synapse Admin API ansible.builtin.fail: @@ -57,7 +57,7 @@ with_items: - {'name': 'matrix_bot_draupnir_config_accessToken', when: "{{ matrix_bot_draupnir_pantalaimon_use }}"} - {'name': 'matrix_bot_draupnir_config_accessToken', when: "{{ matrix_bot_draupnir_login_native }}"} - when: "item.when | bool and not (vars[item.name] == '' or vars[item.name] is none)" + when: "item.when | bool and not (lookup('vars', item.name, default='') == '' or lookup('vars', item.name, default='') is none)" - name: Fail when matrix_bot_draupnir_config_experimentalRustCrypto is enabled together with matrix_bot_draupnir_pantalaimon_use ansible.builtin.fail: diff --git a/roles/custom/matrix-bridge-hookshot/tasks/validate_config.yml b/roles/custom/matrix-bridge-hookshot/tasks/validate_config.yml index 5364b063c..6a09e3834 100644 --- a/roles/custom/matrix-bridge-hookshot/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-hookshot/tasks/validate_config.yml @@ -51,7 +51,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - "matrix_hookshot_appservice_token" - "matrix_hookshot_homeserver_address" @@ -62,7 +62,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable GitHub. - when: "matrix_hookshot_github_enabled and vars[item] == ''" + when: "matrix_hookshot_github_enabled and lookup('vars', item, default='') == ''" with_items: - "matrix_hookshot_github_auth_id" - "matrix_hookshot_github_webhook_secret" @@ -71,7 +71,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable GitHub OAuth. - when: "matrix_hookshot_github_oauth_enabled and vars[item] == ''" + when: "matrix_hookshot_github_oauth_enabled and lookup('vars', item, default='') == ''" with_items: - "matrix_hookshot_github_oauth_client_id" - "matrix_hookshot_github_oauth_client_secret" @@ -80,7 +80,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable Jira. - when: "matrix_hookshot_jira_enabled and vars[item] == ''" + when: "matrix_hookshot_jira_enabled and lookup('vars', item, default='') == ''" with_items: - "matrix_hookshot_jira_webhook_secret" @@ -88,7 +88,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) to enable Jira OAuth. - when: "matrix_hookshot_jira_oauth_enabled and vars[item] == ''" + when: "matrix_hookshot_jira_oauth_enabled and lookup('vars', item, default='') == ''" with_items: - "matrix_hookshot_jira_oauth_client_id" - "matrix_hookshot_jira_oauth_client_secret" diff --git a/roles/custom/matrix-client-cinny/tasks/validate_config.yml b/roles/custom/matrix-client-cinny/tasks/validate_config.yml index fee52fe3c..84719ed47 100644 --- a/roles/custom/matrix-client-cinny/tasks/validate_config.yml +++ b/roles/custom/matrix-client-cinny/tasks/validate_config.yml @@ -36,7 +36,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - matrix_client_cinny_container_labels_traefik_hostname - matrix_client_cinny_container_labels_traefik_path_prefix diff --git a/roles/custom/matrix-corporal/tasks/validate_config.yml b/roles/custom/matrix-corporal/tasks/validate_config.yml index cb394b81c..fd5cf11d4 100644 --- a/roles/custom/matrix-corporal/tasks/validate_config.yml +++ b/roles/custom/matrix-corporal/tasks/validate_config.yml @@ -10,7 +10,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using matrix-corporal. - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - "matrix_corporal_container_network" - "matrix_corporal_matrix_homeserver_api_endpoint" diff --git a/roles/custom/matrix-livekit-jwt-service/tasks/validate_config.yml b/roles/custom/matrix-livekit-jwt-service/tasks/validate_config.yml index 440f720fd..fa2f4ab04 100644 --- a/roles/custom/matrix-livekit-jwt-service/tasks/validate_config.yml +++ b/roles/custom/matrix-livekit-jwt-service/tasks/validate_config.yml @@ -10,7 +10,7 @@ ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and vars[item.name] | string | length == 0" + when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - {'name': 'matrix_livekit_jwt_service_hostname', when: true} - {'name': 'matrix_livekit_jwt_service_container_network', when: true} diff --git a/roles/custom/matrix-static-files/tasks/validate_config.yml b/roles/custom/matrix-static-files/tasks/validate_config.yml index fb2319ca3..7924507f7 100644 --- a/roles/custom/matrix-static-files/tasks/validate_config.yml +++ b/roles/custom/matrix-static-files/tasks/validate_config.yml @@ -8,7 +8,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and vars[item.name] | string | length == 0" + when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - {'name': 'matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_hostname', when: "{{ matrix_static_files_container_labels_well_known_matrix_endpoint_enabled }}"} - {'name': 'matrix_static_files_container_labels_well_known_matrix_endpoint_traefik_path_prefix', when: "{{ matrix_static_files_container_labels_well_known_matrix_endpoint_enabled }}"} diff --git a/roles/custom/matrix-synapse-admin/tasks/validate_config.yml b/roles/custom/matrix-synapse-admin/tasks/validate_config.yml index d86fb5fac..2a3699d73 100644 --- a/roles/custom/matrix-synapse-admin/tasks/validate_config.yml +++ b/roles/custom/matrix-synapse-admin/tasks/validate_config.yml @@ -26,7 +26,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`). - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - matrix_synapse_admin_container_labels_traefik_hostname - matrix_synapse_admin_container_labels_traefik_path_prefix diff --git a/roles/custom/matrix-synapse-auto-compressor/tasks/validate_config.yml b/roles/custom/matrix-synapse-auto-compressor/tasks/validate_config.yml index 60a2cc996..65108ad85 100644 --- a/roles/custom/matrix-synapse-auto-compressor/tasks/validate_config.yml +++ b/roles/custom/matrix-synapse-auto-compressor/tasks/validate_config.yml @@ -20,7 +20,7 @@ ansible.builtin.fail: msg: > You need to define a required configuration setting (`{{ item }}`). - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - matrix_synapse_auto_compressor_database_hostname - matrix_synapse_auto_compressor_database_password diff --git a/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/validate_config.yml b/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/validate_config.yml index b9e84a3d2..a6b42ee7a 100644 --- a/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/validate_config.yml +++ b/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/validate_config.yml @@ -9,7 +9,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using s3-storage-provider. - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - "matrix_synapse_ext_synapse_s3_storage_provider_config_bucket" - "matrix_synapse_ext_synapse_s3_storage_provider_config_region_name" @@ -19,7 +19,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using s3-storage-provider. - when: "not matrix_synapse_ext_synapse_s3_storage_provider_config_ec2_instance_profile | bool and vars[item] == ''" + when: "not matrix_synapse_ext_synapse_s3_storage_provider_config_ec2_instance_profile | bool and lookup('vars', item, default='') == ''" with_items: - "matrix_synapse_ext_synapse_s3_storage_provider_config_access_key_id" - "matrix_synapse_ext_synapse_s3_storage_provider_config_secret_access_key" diff --git a/roles/custom/matrix-synapse/tasks/ext/synapse-http-antispam/validate_config.yml b/roles/custom/matrix-synapse/tasks/ext/synapse-http-antispam/validate_config.yml index 037842f14..cfa304bd9 100644 --- a/roles/custom/matrix-synapse/tasks/ext/synapse-http-antispam/validate_config.yml +++ b/roles/custom/matrix-synapse/tasks/ext/synapse-http-antispam/validate_config.yml @@ -8,7 +8,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item }}`) for using synapse-http-antispam. - when: "vars[item] == ''" + when: "lookup('vars', item, default='') == ''" with_items: - "matrix_synapse_ext_synapse_http_antispam_enabled" - "matrix_synapse_ext_synapse_http_antispam_config_base_url" diff --git a/roles/custom/matrix-synapse/tasks/validate_config.yml b/roles/custom/matrix-synapse/tasks/validate_config.yml index 9f10330a2..3f25cc934 100644 --- a/roles/custom/matrix-synapse/tasks/validate_config.yml +++ b/roles/custom/matrix-synapse/tasks/validate_config.yml @@ -10,7 +10,7 @@ ansible.builtin.fail: msg: >- You need to define a required configuration setting (`{{ item.name }}`). - when: "item.when | bool and vars[item.name] | string | length == 0" + when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0" with_items: - {'name': 'matrix_synapse_username', when: true} - {'name': 'matrix_synapse_uid', when: true} @@ -48,7 +48,7 @@ ansible.builtin.fail: msg: >- `{{ item }}` cannot be more than 1. This is a single-instance worker. - when: "vars[item] | int > 1" + when: "lookup('vars', item, default='') | int > 1" with_items: - "matrix_synapse_workers_appservice_workers_count" - "matrix_synapse_workers_user_dir_workers_count" @@ -166,7 +166,7 @@ - name: Fail if known Synapse password provider modules are enabled when auth is delegated to Matrix Authentication Service ansible.builtin.fail: msg: "When Synapse is delegating authentication to Matrix Authentication Service (`matrix_synapse_matrix_authentication_service_enabled: true`), it does not make sense to enable password provider modules, because it is not Synapse that is handling authentication. Please disable {{ item }} before enabling Matrix Authentication Service integration for Synapse. Synapse will refuse to start otherwise." - when: matrix_synapse_matrix_authentication_service_enabled and vars[item] | bool + when: matrix_synapse_matrix_authentication_service_enabled and lookup('vars', item, default='') | bool with_items: - matrix_synapse_ext_password_provider_rest_auth_enabled - matrix_synapse_ext_password_provider_shared_secret_auth_enabled