homeserver/roles/PyratLabs.k3s/tasks/pre_checks_packages.yml
mg 3cc377c1a7 Rolle aktualisiert: k3s (#455)
Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: #455
2023-02-17 12:00:24 +01:00

26 lines
918 B
YAML

---
- name: Check that {{ package.name }} is installed
ansible.builtin.command:
cmd: "which {{ package.name }}"
changed_when: false
failed_when: false
register: check_k3s_required_package
become: "{{ k3s_become }}"
- name: Test that checks for {{ package.name }} passed
ansible.builtin.assert:
that:
- check_k3s_required_package.rc == 0
success_msg: "Found required package: {{ package.name }}."
fail_msg: >-
Could not find package: {{ package.name }}.
{% if package.documentation is defined %}
Documentation: {{ package.documentation }}
{% endif %}
when:
- check_k3s_required_package.rc is defined
- (package.until is not defined
or (k3s_release_version | replace('v', '')) is version_compare(package.until, '<'))
- (package.from is not defined
or (k3s_release_version | replace('v', '')) is version_compare(package.from, '>='))