Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

62 lines
3.3 KiB

  1. # SPDX-FileCopyrightText: 2019 Edgars Voroboks
  2. # SPDX-FileCopyrightText: 2019 Dan Arnfield
  3. # SPDX-FileCopyrightText: 2019 - 2023 Slavi Pantaleev
  4. # SPDX-FileCopyrightText: 2020 Chris van Dijk
  5. # SPDX-FileCopyrightText: 2022 Marko Weltzer
  6. #
  7. # SPDX-License-Identifier: AGPL-3.0-or-later
  8. ---
  9. - name: Fail if required Dimension settings not defined
  10. ansible.builtin.fail:
  11. msg: >
  12. You need to define a required configuration setting (`{{ item.name }}`).
  13. when: "item.when | bool and vars[item.name] == ''"
  14. with_items:
  15. - {'name': 'matrix_dimension_hostname', when: true}
  16. - {'name': 'matrix_dimension_container_network', when: true}
  17. - {'name': 'matrix_dimension_access_token', when: true}
  18. - {'name': 'matrix_dimension_homeserver_clientServerUrl', when: true}
  19. - {'name': 'matrix_dimension_homeserver_federationUrl', when: true}
  20. - {'name': 'matrix_dimension_homeserver_mediaUrl', when: true}
  21. - {'name': 'matrix_dimension_database_hostname', when: "{{ matrix_dimension_database_engine == 'postgres' }}"}
  22. - name: (Deprecation) Catch and report renamed Dimension variables
  23. ansible.builtin.fail:
  24. msg: >-
  25. Your configuration contains a variable, which now has a different name.
  26. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  27. when: "item.old in vars"
  28. with_items:
  29. - {'old': 'matrix_dimension_container_expose_port', 'new': '<superseded by matrix_dimension_container_http_host_bind_port>'}
  30. - {'old': 'matrix_dimension_container_image_name_prefix', 'new': 'matrix_dimension_docker_image_registry_prefix'}
  31. - when: matrix_dimension_container_labels_traefik_enabled | bool
  32. block:
  33. - name: Fail if required Dimension Traefik settings not defined
  34. ansible.builtin.fail:
  35. msg: >-
  36. You need to define a required configuration setting (`{{ item }}`).
  37. when: "vars[item] == ''"
  38. with_items:
  39. - matrix_dimension_container_labels_traefik_hostname
  40. - matrix_dimension_container_labels_traefik_path_prefix
  41. # We ensure it doesn't end with a slash, because we handle both (slash and no-slash).
  42. # Knowing that `matrix_dimension_container_labels_traefik_path_prefix` does not end with a slash
  43. # ensures we know how to set these routes up without having to do "does it end with a slash" checks elsewhere.
  44. - name: Fail if matrix_dimension_container_labels_traefik_path_prefix ends with a slash
  45. ansible.builtin.fail:
  46. msg: >-
  47. matrix_dimension_container_labels_traefik_path_prefix (`{{ matrix_dimension_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/dimension`).
  48. when: "matrix_dimension_container_labels_traefik_path_prefix != '/' and matrix_dimension_container_labels_traefik_path_prefix[-1] == '/'"
  49. - name: Fail if matrix_dimension_container_labels_traefik_path_prefix is not /
  50. ansible.builtin.fail:
  51. msg: >-
  52. matrix_dimension_container_labels_traefik_path_prefix (`{{ matrix_dimension_container_labels_traefik_path_prefix }}`) must currently be set to `/`.
  53. Other values are not supported.
  54. See: https://github.com/turt2live/matrix-dimension/issues/510
  55. when: "matrix_dimension_container_labels_traefik_path_prefix != '/' and matrix_dimension_container_labels_traefik_path_prefix[-1] == '/'"