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.
 
 

71 line
4.5 KiB

  1. # SPDX-FileCopyrightText: 2019 - 2025 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2022 MDAD project contributors
  3. # SPDX-FileCopyrightText: 2025 Suguru Hirahara
  4. #
  5. # SPDX-License-Identifier: AGPL-3.0-or-later
  6. ---
  7. - name: Fail if required appservice-irc settings not defined
  8. ansible.builtin.fail:
  9. msg: >-
  10. You need to define a required configuration setting (`{{ item.name }}`).
  11. when: "item.when | bool and lookup('vars', item.name, default='') | string | length == 0"
  12. with_items:
  13. - {'name': 'matrix_appservice_irc_appservice_token', when: true}
  14. - {'name': 'matrix_appservice_irc_homeserver_url', when: true}
  15. - {'name': 'matrix_appservice_irc_homeserver_token', when: true}
  16. - {'name': 'matrix_appservice_irc_database_hostname', when: "{{ matrix_appservice_irc_database_engine == 'postgres' }}"}
  17. - {'name': 'matrix_appservice_irc_container_network', when: true}
  18. # Our base configuration (`matrix_appservice_irc_configuration_yaml`) is not enough to
  19. # let the playbook run without errors.
  20. #
  21. # Unless the final configuration (`matrix_appservice_irc_configuration`) contains an `ircService` definition,
  22. # we'd fail generating the registration.yaml file with a non-helpful error.
  23. #
  24. # This is a safety check to ensure we fail earlier and in a nicer way.
  25. - name: Fail if no additional configuration provided
  26. ansible.builtin.fail:
  27. msg: >-
  28. Your Appservice IRC configuration is incomplete (lacking an `ircService.servers` configuration).
  29. You need to define one or more servers by either using `matrix_appservice_irc_ircService_servers`
  30. or by extending the base configuration with additional configuration in `matrix_appservice_irc_configuration_extension_yaml`.
  31. Overriding the whole bridge's configuration (`matrix_appservice_irc_configuration`) is yet another possibility.
  32. when: "matrix_appservice_irc_configuration.ircService.servers | length == 0"
  33. - name: (Deprecation) Catch and report renamed appservice-irc variables
  34. ansible.builtin.fail:
  35. msg: >-
  36. Your configuration contains a variable, which now has a different name.
  37. Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml).
  38. when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0"
  39. with_items:
  40. - {'old': 'matrix_appservice_irc_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_irc_container_http_host_bind_port>'}
  41. - {'old': 'matrix_appservice_irc_container_self_build', 'new': 'matrix_appservice_irc_container_image_self_build'}
  42. - {'old': 'matrix_appservice_irc_docker_image_name_prefix', 'new': 'matrix_appservice_irc_docker_image_registry_prefix'}
  43. - {'old': 'matrix_appservice_irc_homeserver_media_url', 'new': '<removed; media proxying now uses matrix_appservice_irc_ircService_mediaProxy_publicUrl>'}
  44. - name: Fail if matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix does not start with a slash
  45. ansible.builtin.fail:
  46. msg: >-
  47. matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix (`{{ matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix }}`) must start with a slash (e.g. `/` or `/irc/`).
  48. when: "matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix[0] != '/'"
  49. - name: Fail if matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix does not end with a slash
  50. ansible.builtin.fail:
  51. msg: >-
  52. matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix (`{{ matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix }}`) must end with a slash (e.g. `/` or `/irc/`).
  53. when: "matrix_appservice_irc_ircService_mediaProxy_publicUrl_pathPrefix[-1] != '/'"
  54. - when: matrix_appservice_irc_container_labels_traefik_enabled | bool
  55. block:
  56. # We ensure it doesn't end with a slash, because we handle both (slash and no-slash).
  57. # Knowing that the path_prefix does not end with a slash ensures we know how to set these routes up
  58. # without having to do "does it end with a slash" checks elsewhere.
  59. - name: Fail if matrix_appservice_irc_container_labels_media_proxy_traefik_path_prefix ends with a slash
  60. ansible.builtin.fail:
  61. msg: >-
  62. matrix_appservice_irc_container_labels_media_proxy_traefik_path_prefix (`{{ matrix_appservice_irc_container_labels_media_proxy_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/irc`).
  63. when: "matrix_appservice_irc_container_labels_media_proxy_traefik_path_prefix != '/' and matrix_appservice_irc_container_labels_media_proxy_traefik_path_prefix[-1] == '/'"