ansible-infra/playbooks/roles/distribution_check/tasks/main.yml

21 lines
1.1 KiB
YAML
Raw Normal View History

- name: Set fact holding list of supported distribution names
ansible.builtin.set_fact:
distribution_check__supported_distribution_names: "{{ distribution_check__supported_distributions | community.general.json_query('[].name') }}"
- name: Fail on unsupported distribution (name)
ansible.builtin.fail:
msg: The hosts distribution (name) isn't supported.
when: ansible_facts.distribution not in distribution_check__supported_distribution_names
- name: Set fact holding list of supported distribution versions
ansible.builtin.set_fact:
distribution_check__supported_distribution_versions: "{{ distribution_check__supported_distributions
| community.general.json_query(distribution_check__supported_distribution_versions_query) }}"
vars:
distribution_check__supported_distribution_versions_query: "[?name=='{{ ansible_facts.distribution }}'].versions | [].to_string(@)"
- name: Fail on unsupported distribution version
ansible.builtin.fail:
msg: The hosts distribution version isn't supported.
when: ansible_facts.distribution_version not in distribution_check__supported_distribution_versions