Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

80 wiersze
3.4 KiB

  1. ---
  2. # roles/custom/matrix-element-call/tasks/validate_config.yml
  3. - name: Ensure required variables for Element Call are defined
  4. ansible.builtin.fail:
  5. msg: "The variable '{{ item }}' is required and must be set."
  6. when: vars[item] is not defined or vars[item] == ''
  7. loop:
  8. - matrix_element_call_enabled
  9. - matrix_element_call_version
  10. - matrix_element_call_hostname
  11. - matrix_element_call_path_prefix
  12. - matrix_element_call_base_path
  13. - matrix_element_call_container_image
  14. - matrix_element_call_container_network
  15. - matrix_element_call_container_labels_traefik_hostname
  16. - matrix_element_call_jwt_service_url
  17. - matrix_element_call_livekit_service_url
  18. - matrix_element_call_livekit_dev_key
  19. - name: Validate that the Element Call hostname is properly formatted
  20. ansible.builtin.assert:
  21. that:
  22. - matrix_element_call_hostname is match('^([a-zA-Z0-9][-a-zA-Z0-9]*[a-zA-Z0-9])$')
  23. fail_msg: "The hostname '{{ matrix_element_call_hostname }}' is not valid. It should be a valid domain or subdomain."
  24. success_msg: "The hostname '{{ matrix_element_call_hostname }}' is valid."
  25. - name: Validate that the Element Call version is specified correctly
  26. ansible.builtin.assert:
  27. that:
  28. - matrix_element_call_version is string
  29. - matrix_element_call_version != ''
  30. fail_msg: "The Element Call version must be a non-empty string."
  31. success_msg: "The Element Call version is set correctly."
  32. - name: Ensure LiveKit dev key is set
  33. ansible.builtin.assert:
  34. that:
  35. - matrix_element_call_livekit_dev_key is string
  36. - matrix_element_call_livekit_dev_key != ''
  37. fail_msg: "The LiveKit dev key (matrix_element_call_livekit_dev_key) must be a non-empty string."
  38. success_msg: "The LiveKit dev key is set correctly."
  39. - name: Ensure JWT service URL is valid
  40. ansible.builtin.assert:
  41. that:
  42. - matrix_element_call_jwt_service_url is match('^https?://[a-zA-Z0-9.-]+$')
  43. fail_msg: "The JWT service URL '{{ matrix_element_call_jwt_service_url }}' is not valid."
  44. success_msg: "The JWT service URL is valid."
  45. - name: Ensure LiveKit service URL is valid
  46. ansible.builtin.assert:
  47. that:
  48. - matrix_element_call_livekit_service_url is match('^https?://[a-zA-Z0-9.-]+$')
  49. fail_msg: "The LiveKit service URL '{{ matrix_element_call_livekit_service_url }}' is not valid."
  50. success_msg: "The LiveKit service URL is valid."
  51. - name: Ensure matrix-element-call base path is set and exists
  52. ansible.builtin.assert:
  53. that:
  54. - matrix_element_call_base_path is string
  55. - matrix_element_call_base_path != ''
  56. fail_msg: "The base path for Element Call (matrix_element_call_base_path) must be a non-empty string."
  57. success_msg: "The base path for Element Call is set correctly."
  58. - name: Ensure required paths for configurations are accessible
  59. ansible.builtin.file:
  60. path: "{{ item }}"
  61. state: directory
  62. with_items:
  63. - "{{ matrix_element_call_base_path }}/config"
  64. - "{{ matrix_element_call_base_path }}/backend"
  65. register: config_paths_check
  66. - name: Fail if any required paths for configurations are not accessible
  67. ansible.builtin.fail:
  68. msg: "The required configuration path '{{ item.path }}' does not exist or is not accessible."
  69. when: config_paths_check.results is defined and config_paths_check.results | selectattr('failed', 'eq', True) | list | length > 0
  70. loop: "{{ config_paths_check.results | selectattr('failed', 'eq', True) | list }}"