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.

82 lines
4.5 KiB

  1. ---
  2. - name: Fail if invalid homeserver implementation
  3. fail:
  4. msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`"
  5. when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']"
  6. # We generally support Ansible 2.7.1 and above.
  7. - name: Fail if running on Ansible < 2.7.1
  8. fail:
  9. msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
  10. when:
  11. - "(ansible_version.major < 2) or (ansible_version.major == 2 and ansible_version.minor < 7) or (ansible_version.major == 2 and ansible_version.minor == 7 and ansible_version.revision < 1)"
  12. # Though we do not support Ansible 2.9.6 which is buggy
  13. - name: Fail if running on Ansible 2.9.6 on Ubuntu
  14. fail:
  15. msg: "You are running on Ansible {{ ansible_version.string }}, which is not supported. See our guide about Ansible: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md"
  16. when:
  17. - ansible_distribution == 'Ubuntu'
  18. - "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
  19. - name: (Deprecation) Catch and report renamed settings
  20. fail:
  21. msg: >-
  22. Your configuration contains a variable, which now has a different name.
  23. Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
  24. when: "item.old in vars"
  25. with_items:
  26. - {'old': 'host_specific_hostname_identity', 'new': 'matrix_domain'}
  27. - {'old': 'hostname_identity', 'new': 'matrix_domain'}
  28. - {'old': 'hostname_matrix', 'new': 'matrix_server_fqn_matrix'}
  29. - {'old': 'hostname_riot', 'new': 'matrix_server_fqn_element'}
  30. - {'old': 'matrix_server_fqn_riot', 'new': 'matrix_server_fqn_element'}
  31. # We have a dedicated check for this variable, because we'd like to have a custom (friendlier) message.
  32. - name: Fail if matrix_homeserver_generic_secret_key is undefined
  33. fail:
  34. msg: |
  35. The `matrix_homeserver_generic_secret_key` variable must be defined and have a non-null and non-empty value.
  36. If you're observing this error on a new installation, you should ensure that the `matrix_homeserver_generic_secret_key` is defined.
  37. If you're observing this error on an existing homeserver installation, you can fix it easily and in a backward-compatible way by adding
  38. `{% raw %}matrix_homeserver_generic_secret_key: "{{ matrix_synapse_macaroon_secret_key }}"{% endraw %}`
  39. to your `vars.yml` file. Using another secret value for the new variable is also possible and shouldn't cause any trouble.
  40. when: "matrix_homeserver_generic_secret_key is none or matrix_homeserver_generic_secret_key == ''"
  41. - name: Fail if required variables are undefined
  42. fail:
  43. msg: "The `{{ item.var }}` variable must be defined and have a non-null and non-empty value"
  44. with_items:
  45. - {'var': matrix_domain, 'value': "{{ matrix_domain|default('') }}"}
  46. - {'var': matrix_server_fqn_matrix, 'value': "{{ matrix_server_fqn_matrix|default('') }}"}
  47. - {'var': matrix_server_fqn_element, 'value': "{{ matrix_server_fqn_element|default('') }}"}
  48. - {'var': matrix_homeserver_container_url, 'value': "{{ matrix_homeserver_container_url|default('') }}"}
  49. - {'var': matrix_homeserver_container_federation_url, 'value': "{{ matrix_homeserver_container_federation_url|default('') }}"}
  50. when: "item.value is none or item.value == ''"
  51. - name: Fail if uppercase domain used
  52. fail:
  53. msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!"
  54. with_items:
  55. - "{{ matrix_domain }}"
  56. - "{{ matrix_server_fqn_matrix }}"
  57. - "{{ matrix_server_fqn_element }}"
  58. when: "item != item|lower"
  59. - name: Fail if using python2 on Archlinux
  60. fail:
  61. msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3."
  62. when:
  63. - ansible_distribution == 'Archlinux'
  64. - ansible_python.version.major != 3
  65. - name: Fail if architecture is set incorrectly
  66. fail:
  67. msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}."
  68. when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or
  69. (ansible_architecture == "aarch64" and matrix_architecture != "arm64") or
  70. (ansible_architecture.startswith("armv") and matrix_architecture != "arm32")