2023-07-08 19:58:02 +02:00
- name : set fact holding list of supported distribution names
2022-11-11 14:10:43 +01:00
ansible.builtin.set_fact :
2023-07-08 19:58:02 +02:00
distribution_check__supported_distribution_names : "{{ distribution_check__distribution_support_spec
| community.general.json_query('[].name') }}"
2022-11-11 14:10:43 +01:00
2023-07-08 19:58:02 +02:00
- name : fail on unsupported distribution (name)
2022-11-11 14:10:43 +01:00
ansible.builtin.fail :
msg : The hosts distribution (name) isn't supported.
2023-07-08 19:58:02 +02:00
when : ansible_facts['distribution'] not in distribution_check__supported_distribution_names
2022-11-11 14:10:43 +01:00
2023-07-08 19:58:02 +02:00
- name : set facts for holding lists of supported distribution versions, major versions and releases
block :
- name : set fact holding list of supported distribution versions
ansible.builtin.set_fact :
distribution_check__supported_distribution_versions : "{{ distribution_check__distribution_support_spec
| 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 : set fact holding list of supported distribution major versions
ansible.builtin.set_fact :
distribution_check__supported_distribution_major_versions : "{{ distribution_check__distribution_support_spec
| community.general.json_query(distribution_check__supported_distribution_major_versions_query) }}"
vars :
distribution_check__supported_distribution_major_versions_query : "[?name=='{{ ansible_facts['distribution'] }}'].major_versions | [].to_string(@)"
- name : set fact holding list of supported distribution releases
ansible.builtin.set_fact :
distribution_check__supported_distribution_releases : "{{ distribution_check__distribution_support_spec
| community.general.json_query(distribution_check__supported_distribution_releases_query) }}"
vars :
distribution_check__supported_distribution_releases_query : "[?name=='{{ ansible_facts['distribution'] }}'].releases | [].to_string(@)"
- name : check for distribution version, major version and release support
block :
- name : set fact on whether the distribution version is supported
ansible.builtin.set_fact :
distribution_check__distribution_version_supported : "{{ ansible_facts['distribution_version'] in distribution_check__supported_distribution_versions }}"
- name : set fact on whether the distribution major version is supported
ansible.builtin.set_fact :
distribution_check__distribution_major_version_supported : "{{ ansible_facts['distribution_major_version'] in distribution_check__supported_distribution_major_versions }}" # noqa: yaml[line-length]
- name : set fact on whether the distribution release is supported
ansible.builtin.set_fact :
distribution_check__distribution_release_supported : "{{ ansible_facts['distribution_release'] in distribution_check__supported_distribution_releases }}"
2022-11-11 14:10:43 +01:00
2023-07-08 19:58:02 +02:00
- name : fail, if neither the distributions version, major version or release is supported
2022-11-11 14:10:43 +01:00
ansible.builtin.fail :
2023-07-08 19:58:02 +02:00
msg : Neither the hosts distribution version, major version or release is supported.
when : not (distribution_check__distribution_version_supported
or distribution_check__distribution_major_version_supported
or distribution_check__distribution_release_supported)