Make matrix_homeserver_implementation influence matrix_IMPLEMENTATION_enabled, not the other way around

Doing this seems more reasonable and simpler.
This commit is contained in:
Slavi Pantaleev 2021-12-23 16:28:34 +02:00
parent 4139290cc9
commit 1dfe21944f
5 changed files with 19 additions and 26 deletions

View File

@ -10,6 +10,10 @@
# Example value: example.com
matrix_domain: YOUR_BARE_DOMAIN_NAME_HERE
# The Matrix homeserver software to install.
# See `roles/matrix-base/defaults/main.yml` for valid options.
matrix_homeserver_implementation: synapse
# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains.
#
# In case SSL renewal fails at some point, you'll also get an email notification there.

View File

@ -17,17 +17,6 @@ matrix_container_global_registry_prefix: "docker.io/"
#
######################################################################
matrix_homeserver_enabled_implementations_list: |
{{
(
(['synapse'] if matrix_synapse_enabled else [])
+
(['dendrite'] if matrix_dendrite_enabled else [])
)
}}
matrix_homeserver_implementation: "{{ matrix_homeserver_enabled_implementations_list[0] if matrix_homeserver_enabled_implementations_list|length == 1 else '' }}"
matrix_identity_server_url: "{{ ('https://' + matrix_server_fqn_matrix) if matrix_ma1sd_enabled else None }}"
# If Synapse workers are enabled and matrix-nginx-proxy is disabled, certain APIs may not work over 'http://matrix-synapse:{{ matrix_synapse_container_client_api_port }}'.
@ -1906,6 +1895,8 @@ matrix_client_cinny_self_check_validate_certificates: "{{ false if matrix_ssl_re
#
######################################################################
matrix_synapse_enabled: "{{ matrix_homeserver_implementation == 'synapse' }}"
matrix_synapse_container_image_self_build: "{{ matrix_architecture not in ['arm64', 'amd64'] }}"
# When ma1sd is enabled, we can use it to validate email addresses and phone numbers.
@ -2205,6 +2196,8 @@ matrix_postgres_backup_databases: |
#
######################################################################
matrix_dendrite_enabled: "{{ matrix_homeserver_implementation == 'dendrite' }}"
# Normally, matrix-nginx-proxy is enabled and nginx can reach Dendrite over the container network.
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it,
# you can expose Dendrite's ports to the host.

View File

@ -8,11 +8,13 @@
matrix_domain: ~
# This will contain the homeserver implementation that is in use.
# Example values: 'synapse', 'dendrite', etc.
# You normally don't need to set this variable manually.
# Its value is automatically set depending on the homeserver implementation that you have enabled via other variables
# (e.g. `matrix_synapse_enabled`, `matrix_dendrite_enabled`, etc.)
matrix_homeserver_implementation: ''
# Valid values: synapse, dendrite
#
# By default, we use Synapse, because it's the only full-featured Matrix server at the moment.
#
# This value automatically influences other variables (`matrix_synapse_enabled`, `matrix_dendrite_enabled`, etc.).
# The homeserver implementation of an existing server cannot be changed without data loss.
matrix_homeserver_implementation: synapse
# This is where your data lives and what we set up.
# This and the Element FQN (see below) are expected to be on the same server.

View File

@ -1,15 +1,9 @@
---
- name: Fail if 0 or more than 1 homeserver implementations enabled
- name: Fail if invalid homeserver implementation
fail:
msg: >-
You have 0 or more than 1 homeserver implementations enabled
({{ matrix_homeserver_enabled_implementations_list|join(', ') }}).
If you have more than 1 implementation enabled, you can disable the unnecessary implementations by adding `matrix_IMPLEMENTATION_enabled: false` to your vars.yml file.
If you have 0 implementations enabled, you can enable one by adding `matrix_IMPLEMENTATION_enabled: false` to your vars.yml file (e.g. `matrix_dendrite_enabled: true`).
when: "matrix_homeserver_enabled_implementations_list|length != 1"
msg: "You need to set a valid homeserver implementation in `matrix_homeserver_implementation`"
when: "matrix_homeserver_implementation not in ['synapse', 'dendrite']"
# We generally support Ansible 2.7.1 and above.
- name: Fail if running on Ansible < 2.7.1

View File

@ -1,7 +1,7 @@
# Dendrite is a second-generation Matrix homeserver currently in Beta
# See: https://github.com/matrix-org/dendrite
matrix_dendrite_enabled: false
matrix_dendrite_enabled: true
matrix_dendrite_docker_image: "{{ matrix_dendrite_docker_image_name_prefix }}matrixdotorg/dendrite-monolith:{{ matrix_dendrite_docker_image_tag }}"
matrix_dendrite_docker_image_name_prefix: "docker.io/"