Matrix Docker Ansible eploy
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

94 行
4.7 KiB

  1. # SPDX-FileCopyrightText: 2024 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2025 Suguru Hirahara
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Fail if required baibot settings not defined
  7. ansible.builtin.fail:
  8. msg: >-
  9. You need to define a required configuration setting (`{{ item.name }}`).
  10. when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0"
  11. with_items:
  12. - {'name': 'matrix_bot_baibot_config_user_mxid_localpart', when: true}
  13. - {'name': 'matrix_bot_baibot_container_network', when: true}
  14. - {'name': 'matrix_bot_baibot_config_homeserver_url', when: true}
  15. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_anthropic_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_anthropic_enabled }}"}
  16. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_groq_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_enabled }}"}
  17. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id', when: "{{ matrix_bot_baibot_config_agents_static_definitions_groq_enabled and matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_enabled }}"}
  18. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_mistral_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_mistral_enabled }}"}
  19. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_model_id', when: "{{ matrix_bot_baibot_config_agents_static_definitions_mistral_enabled and matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_enabled }}"}
  20. - {'name': 'matrix_bot_baibot_config_agents_static_definitions_openai_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_openai_enabled }}"}
  21. - name: Fail if baibot authentication mode is not configured
  22. ansible.builtin.fail:
  23. msg: >-
  24. You need to configure one baibot authentication mode:
  25. either `matrix_bot_baibot_config_user_password`
  26. or (`matrix_bot_baibot_config_user_access_token` + `matrix_bot_baibot_config_user_device_id`).
  27. when: >-
  28. (
  29. matrix_bot_baibot_config_user_password | default('', true) | string | length == 0
  30. )
  31. and
  32. (
  33. matrix_bot_baibot_config_user_access_token | default('', true) | string | length == 0
  34. and matrix_bot_baibot_config_user_device_id | default('', true) | string | length == 0
  35. )
  36. - name: Fail if baibot authentication mode is configured ambiguously
  37. ansible.builtin.fail:
  38. msg: >-
  39. You need to configure exactly one baibot authentication mode.
  40. Set either `matrix_bot_baibot_config_user_password`,
  41. or (`matrix_bot_baibot_config_user_access_token` + `matrix_bot_baibot_config_user_device_id`) but not both.
  42. when: >-
  43. (
  44. matrix_bot_baibot_config_user_password | default('', true) | string | length > 0
  45. )
  46. and
  47. (
  48. matrix_bot_baibot_config_user_access_token | default('', true) | string | length > 0
  49. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length > 0
  50. )
  51. - name: Fail if baibot access token authentication is incomplete
  52. ansible.builtin.fail:
  53. msg: >-
  54. Access-token authentication requires both
  55. `matrix_bot_baibot_config_user_access_token` and `matrix_bot_baibot_config_user_device_id`.
  56. when: >-
  57. (
  58. matrix_bot_baibot_config_user_password | default('', true) | string | length == 0
  59. )
  60. and
  61. (
  62. matrix_bot_baibot_config_user_access_token | default('', true) | string | length > 0
  63. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length > 0
  64. )
  65. and
  66. (
  67. matrix_bot_baibot_config_user_access_token | default('', true) | string | length == 0
  68. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length == 0
  69. )
  70. - name: Fail if admin patterns list is empty
  71. ansible.builtin.fail:
  72. msg: >-
  73. You need to define a required configuration setting (`matrix_bot_baibot_config_access_admin_patterns`) to specify which users are bot administrators.
  74. when: "matrix_bot_baibot_config_access_admin_patterns | length == 0"
  75. - name: (Deprecation) Catch and report renamed baibot settings
  76. ansible.builtin.fail:
  77. msg: >-
  78. Your configuration contains a variable, which now has a different name.
  79. Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
  80. when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
  81. with_items:
  82. - {'old': 'matrix_bot_baibot_container_image_name_prefix', 'new': 'matrix_bot_baibot_container_image_registry_prefix'}