2018-12-23 17:14:01 +00:00
---
2020-09-29 09:37:39 +00:00
# We generally support Ansible 2.5.2 and above.
#
2019-01-03 14:15:47 +00:00
# Ansible 2.5.0 and 2.5.1 are known to have a bug with `include_tasks` + `with_items`.
# The bug has been fixed in Ansible 2.5.2.
2020-09-29 09:23:39 +00:00
- name : Fail if running on Ansible < 2.5 or Ansible 2.5.x (lower than 2.5.2)
2019-01-03 14:15:47 +00:00
fail :
2020-09-29 09:23:39 +00:00
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"
2020-09-29 09:37:39 +00:00
when : "(ansible_version.major < 2) or (ansible_version.major <= 2 and ansible_version.minor < 5) or (ansible_version.major == 2 and ansible_version.minor == 5 and ansible_version.revision < 2)"
2019-01-03 14:15:47 +00:00
2019-02-28 09:51:09 +00:00
- 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' }
2020-07-17 08:31:20 +00:00
- {'old': 'hostname_riot', 'new' : 'matrix_server_fqn_element' }
- {'old': 'matrix_server_fqn_riot', 'new' : 'matrix_server_fqn_element' }
2019-02-28 09:51:09 +00:00
- 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
2020-07-17 08:31:20 +00:00
- matrix_server_fqn_element
2019-02-28 09:51:09 +00:00
when : "item not in vars or vars[item] is none"
2018-12-23 17:20:53 +00:00
- 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 :
2019-02-28 09:51:09 +00:00
- "{{ matrix_domain }}"
- "{{ matrix_server_fqn_matrix }}"
2020-07-17 08:31:20 +00:00
- "{{ matrix_server_fqn_element }}"
2019-02-28 09:51:09 +00:00
when : "item != item|lower"
2020-03-28 10:39:15 +00:00
- 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