Add compatcheck role

Meant to be used by other roles
This commit is contained in:
uumas
2024-07-28 16:20:48 +03:00
parent 5d16b0a514
commit bad1da0783
4 changed files with 64 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
---
- name: Fail if distribution not supported
ansible.builtin.fail:
msg: "{{ lookup('ansible.builtin.template', 'distroerror.j2').strip() }}"
when: checkfailed
loop:
- "{{ compatcheck_distro | length == 0 }}"
- >
{{
ansible_distribution_major_version != 'n/a' and
compatcheck_distro[0].version_min | default(0) > ansible_distribution_major_version | int
}}
- "{{ compatcheck_distro[0].version_max is defined and compatcheck_distro[0].version_max < ansible_distribution_major_version | int }}"
loop_control:
loop_var: checkfailed