From d07480a883aa2878a3313e369b4c071ca36df764 Mon Sep 17 00:00:00 2001 From: Cody Wyatt Neiman Date: Mon, 2 Jan 2023 19:23:14 -0500 Subject: [PATCH] Remove hardcoded matrix-postgres references --- .../matrix-bridge-mautrix-slack/defaults/main.yml | 2 +- .../tasks/validate_config.yml | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/roles/custom/matrix-bridge-mautrix-slack/defaults/main.yml b/roles/custom/matrix-bridge-mautrix-slack/defaults/main.yml index c2b5a159..ae03943a 100644 --- a/roles/custom/matrix-bridge-mautrix-slack/defaults/main.yml +++ b/roles/custom/matrix-bridge-mautrix-slack/defaults/main.yml @@ -63,7 +63,7 @@ matrix_mautrix_slack_sqlite_database_path_in_container: "/data/mautrix-slack.db" matrix_mautrix_slack_database_username: 'matrix_mautrix_slack' matrix_mautrix_slack_database_password: 'some-password' -matrix_mautrix_slack_database_hostname: 'matrix-postgres' +matrix_mautrix_slack_database_hostname: '' matrix_mautrix_slack_database_port: 5432 matrix_mautrix_slack_database_name: 'matrix_mautrix_slack' diff --git a/roles/custom/matrix-bridge-mautrix-slack/tasks/validate_config.yml b/roles/custom/matrix-bridge-mautrix-slack/tasks/validate_config.yml index 363bbacf..3c764a4e 100644 --- a/roles/custom/matrix-bridge-mautrix-slack/tasks/validate_config.yml +++ b/roles/custom/matrix-bridge-mautrix-slack/tasks/validate_config.yml @@ -1,13 +1,14 @@ --- -- name: Fail if required settings not defined +- name: Fail if required mautrix-slack settings not defined ansible.builtin.fail: msg: >- - You need to define a required configuration setting (`{{ item }}`). - when: "vars[item] == ''" + You need to define a required configuration setting (`{{ item.name }}`). + when: "item.when | bool and vars[item.name] == ''" with_items: - - "matrix_mautrix_slack_appservice_token" - - "matrix_mautrix_slack_homeserver_token" + - {'name': 'matrix_mautrix_slack_appservice_token', when: true} + - {'name': 'matrix_mautrix_slack_homeserver_token', when: true} + - {'name': 'matrix_mautrix_slack_database_hostname', when: "{{ matrix_mautrix_slack_database_engine == 'postgres' }}"} - name: Fail if appservice-slack and mautrix-slack have conflicting bot usernames when: matrix_appservice_slack_enabled | default(False) | bool and matrix_mautrix_slack_appservice_bot_username == matrix_appservice_slack_bot_name | default ('')