ansible-role-k3s/tasks/pre_checks_version.yml

32 lines
907 B
YAML
Raw Normal View History

2019-03-09 21:54:44 +01:00
---
- name: Ensure k3s_release_version is set to default if false
ansible.builtin.set_fact:
k3s_release_version: "{{ k3s_release_channel }}"
2020-07-25 18:39:01 +02:00
check_mode: false
when:
- k3s_release_version is defined
- not k3s_release_version
- name: Ensure the default release channel is set
ansible.builtin.set_fact:
k3s_release_channel: "{{ k3s_release_version | default('stable') }}"
2020-07-25 18:39:01 +02:00
check_mode: false
- name: "Get the latest release version from {{ k3s_api_releases }}"
ansible.builtin.uri:
url: "{{ k3s_api_releases }}"
return_content: true
body_format: json
2019-03-09 21:54:44 +01:00
register: k3s_latest_release
2020-07-25 18:39:01 +02:00
check_mode: false
2019-03-09 21:54:44 +01:00
- name: Ensure the release version is set as a fact
ansible.builtin.set_fact:
k3s_release_version: "{{ item.latest }}"
loop: "{{ k3s_latest_release.json.data }}"
2020-07-25 18:39:01 +02:00
check_mode: false
when:
- item.name == k3s_release_channel
- item.type == "channel"