Files
matrix/roles/conduwuit/tasks/check.yml

35 lines
1.2 KiB
YAML

---
- name: Ensure 'conduwuit_state' is valid
ansible.builtin.fail:
msg: >-2
State '{{ conduwuit_state }}' is not known,
supported states are {{ conduwuit_states | join(', ') }}
when: conduwuit_state not in conduwuit_states
- name: Ensure 'conduwuit_deployment_method' is supported
ansible.builtin.fail:
msg: >-2
Deployment method '{{ conduwuit_deployment_method }}'
is unknown! Supported methods are:
{{ conduwuit_deployment_methods | join(', ') }}
when: conduwuit_deployment_method not in conduwuit_deployment_methods
- name: Ensure required variables are given
ansible.builtin.fail:
msg: "Required variable '{{ item }}' is undefined!"
loop: "{{ conduwuit_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: "{{ conduwuit_conditionally_required_variables }}"
loop_control:
label: "{{ item.name }}"
when: >-2
item.when
and (item.name not in hostvars[inventory_hostname]
or hostvars[inventory_hostname][item.name] | length == 0)