Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

97 строки
5.0 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': 'matrix_bot_baibot_config_agents_static_definitions_venice_config_api_key', when: "{{ matrix_bot_baibot_config_agents_static_definitions_venice_enabled }}"}
  22. - name: Fail if baibot authentication mode is not configured
  23. ansible.builtin.fail:
  24. msg: >-
  25. You need to configure one baibot authentication mode:
  26. either `matrix_bot_baibot_config_user_password`
  27. or (`matrix_bot_baibot_config_user_access_token` + `matrix_bot_baibot_config_user_device_id`).
  28. when: >-
  29. (
  30. matrix_bot_baibot_config_user_password | default('', true) | string | length == 0
  31. )
  32. and
  33. (
  34. matrix_bot_baibot_config_user_access_token | default('', true) | string | length == 0
  35. and matrix_bot_baibot_config_user_device_id | default('', true) | string | length == 0
  36. )
  37. - name: Fail if baibot authentication mode is configured ambiguously
  38. ansible.builtin.fail:
  39. msg: >-
  40. You need to configure exactly one baibot authentication mode.
  41. Set either `matrix_bot_baibot_config_user_password`,
  42. or (`matrix_bot_baibot_config_user_access_token` + `matrix_bot_baibot_config_user_device_id`) but not both.
  43. when: >-
  44. (
  45. matrix_bot_baibot_config_user_password | default('', true) | string | length > 0
  46. )
  47. and
  48. (
  49. matrix_bot_baibot_config_user_access_token | default('', true) | string | length > 0
  50. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length > 0
  51. )
  52. - name: Fail if baibot access token authentication is incomplete
  53. ansible.builtin.fail:
  54. msg: >-
  55. Access-token authentication requires both
  56. `matrix_bot_baibot_config_user_access_token` and `matrix_bot_baibot_config_user_device_id`.
  57. when: >-
  58. (
  59. matrix_bot_baibot_config_user_password | default('', true) | string | length == 0
  60. )
  61. and
  62. (
  63. matrix_bot_baibot_config_user_access_token | default('', true) | string | length > 0
  64. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length > 0
  65. )
  66. and
  67. (
  68. matrix_bot_baibot_config_user_access_token | default('', true) | string | length == 0
  69. or matrix_bot_baibot_config_user_device_id | default('', true) | string | length == 0
  70. )
  71. - name: Fail if admin patterns list is empty
  72. ansible.builtin.fail:
  73. msg: >-
  74. You need to define a required configuration setting (`matrix_bot_baibot_config_access_admin_patterns`) to specify which users are bot administrators.
  75. when: "matrix_bot_baibot_config_access_admin_patterns | length == 0"
  76. - name: (Deprecation) Catch and report renamed baibot settings
  77. ansible.builtin.fail:
  78. msg: >-
  79. Your configuration contains a variable, which now has a different name.
  80. Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
  81. when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
  82. with_items:
  83. - {'old': 'matrix_bot_baibot_container_image_name_prefix', 'new': 'matrix_bot_baibot_container_image_registry_prefix'}
  84. - {'old': 'matrix_bot_baibot_container_image_force_pull', 'new': '<removed> (the new community.docker.docker_image_pull module handles this natively)'}