3cf9f87097
The goal is to have a single variable which tells us which homeserver software is in use. Much simpler than having if/elif/elif checks for variables like (`matrix_synapse_enabled` and `matrix_dendrite_enabled`, etc.) everywhere.
73 lines
3.6 KiB
YAML
73 lines
3.6 KiB
YAML
---
|
|
|
|
- name: Fail if 0 or more than 1 homeserver implementations enabled
|
|
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"
|
|
|
|
# We generally support Ansible 2.7.1 and above.
|
|
- name: Fail if running on Ansible < 2.7.1
|
|
fail:
|
|
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"
|
|
when:
|
|
- "(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)"
|
|
|
|
# Though we do not support Ansible 2.9.6 which is buggy
|
|
- name: Fail if running on Ansible 2.9.6 on Ubuntu
|
|
fail:
|
|
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"
|
|
when:
|
|
- ansible_distribution == 'Ubuntu'
|
|
- "ansible_version.major == 2 and ansible_version.minor == 9 and ansible_version.revision == 6"
|
|
|
|
- name: (Deprecation) Catch and report renamed settings
|
|
fail:
|
|
msg: >-
|
|
Your configuration contains a variable, which now has a different name.
|
|
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
|
|
when: "item.old in vars"
|
|
with_items:
|
|
- {'old': 'host_specific_hostname_identity', 'new': 'matrix_domain'}
|
|
- {'old': 'hostname_identity', 'new': 'matrix_domain'}
|
|
- {'old': 'hostname_matrix', 'new': 'matrix_server_fqn_matrix'}
|
|
- {'old': 'hostname_riot', 'new': 'matrix_server_fqn_element'}
|
|
- {'old': 'matrix_server_fqn_riot', 'new': 'matrix_server_fqn_element'}
|
|
|
|
- name: Fail if required variables are undefined
|
|
fail:
|
|
msg: "The `{{ item }}` variable must be defined and have a non-null value"
|
|
with_items:
|
|
- matrix_domain
|
|
- matrix_server_fqn_matrix
|
|
- matrix_server_fqn_element
|
|
when: "item not in vars or vars[item] is none"
|
|
|
|
- name: Fail if uppercase domain used
|
|
fail:
|
|
msg: "Detected that you're using an uppercase domain name - `{{ item }}`. This will cause trouble. Please use all-lowercase!"
|
|
with_items:
|
|
- "{{ matrix_domain }}"
|
|
- "{{ matrix_server_fqn_matrix }}"
|
|
- "{{ matrix_server_fqn_element }}"
|
|
when: "item != item|lower"
|
|
|
|
- name: Fail if using python2 on Archlinux
|
|
fail:
|
|
msg: "Detected that you're using python2 when installing onto Archlinux. Archlinux by default only supports python3."
|
|
when:
|
|
- ansible_distribution == 'Archlinux'
|
|
- ansible_python.version.major != 3
|
|
|
|
- name: Fail if architecture is set incorrectly
|
|
fail:
|
|
msg: "Detected that variable matrix_architecture {{ matrix_architecture }} appears to be set incorrectly. See docs/alternative-architectures.md. Server appears to be {{ ansible_architecture }}."
|
|
when: (ansible_architecture == "x86_64" and matrix_architecture != "amd64") or
|
|
(ansible_architecture == "aarch64" and matrix_architecture != "arm64") or
|
|
(ansible_architecture.startswith("armv") and matrix_architecture != "arm32")
|