matrix/roles/synapse/tasks/check.yml

33 lines
1.2 KiB
YAML

---
- name: Ensure synapse_state is valid
ansible.builtin.fail:
msg: "State '{{ synapse_state }}' is not known, supported states are {{ synapse_states | join(', ') }}"
when: synapse_state not in synapse_states
- name: Ensure synapse deployment method is supported
ansible.builtin.fail:
msg: >-
Deployment method '{{ synapse_deployment_method }}'
is unknown! Supported methods are:
{{ synapse_deployment_methods | join(', ') }}
when: synapse_deployment_method not in synapse_deployment_methods
- name: Ensure required variables are given
ansible.builtin.fail:
msg: "Required variable '{{ item }}' is undefined!"
loop: "{{ synapse_required_variables }}"
when: >-2
item not in hostvars[inventory_hostname]
or hostvars[inventory_hostname][item] | length == 0
- name: Ensure conditionally required variables are given
ansible.builtin.fail:
msg: "Required variable '{{ item.name }}' is undefined!"
loop: "{{ synapse_conditionally_required_variables }}"
loop_control:
label: "{{ item.name }}"
when: >-2
item.when
and (item.name not in hostvars[ansible_host]
or hostvars[ansible_host][item.name] | length == 0)