2019-03-09 21:54:44 +01:00
|
|
|
---
|
|
|
|
|
2021-12-14 23:45:20 +01:00
|
|
|
# TODO: Prevent or circumvent versioning when k3s_airgap
|
2020-05-18 21:45:48 +02:00
|
|
|
- name: Ensure k3s_release_version is set to default if false
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.set_fact:
|
2020-05-18 21:45:48 +02:00
|
|
|
k3s_release_version: "{{ k3s_release_channel }}"
|
2020-07-25 18:39:01 +02:00
|
|
|
check_mode: false
|
2021-02-16 16:46:01 +01:00
|
|
|
when:
|
|
|
|
- k3s_release_version is defined
|
|
|
|
- not k3s_release_version
|
2020-05-18 21:45:48 +02:00
|
|
|
|
|
|
|
- name: Ensure the default release channel is set
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.set_fact:
|
2020-05-18 21:45:48 +02:00
|
|
|
k3s_release_channel: "{{ k3s_release_version | default('stable') }}"
|
2020-07-25 18:39:01 +02:00
|
|
|
check_mode: false
|
2020-05-18 21:45:48 +02:00
|
|
|
|
|
|
|
- name: Get the latest release version from k3s.io
|
2020-12-12 15:27:59 +01:00
|
|
|
ansible.builtin.uri:
|
2020-05-18 21:45:48 +02:00
|
|
|
url: "{{ k3s_api_releases }}"
|
2019-12-28 16:50:17 +01:00
|
|
|
return_content: true
|
|
|
|
body_format: json
|
2019-03-09 21:54:44 +01:00
|
|
|
register: k3s_latest_release
|
2021-02-28 17:45:38 +01:00
|
|
|
no_log: true
|
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
|
2020-12-21 20:14:52 +01:00
|
|
|
ansible.builtin.set_fact:
|
2020-05-18 21:45:48 +02:00
|
|
|
k3s_release_version: "{{ item.latest }}"
|
|
|
|
loop: "{{ k3s_latest_release.json.data }}"
|
2020-07-25 18:39:01 +02:00
|
|
|
check_mode: false
|
2021-02-16 16:46:01 +01:00
|
|
|
when:
|
|
|
|
- item.name == k3s_release_channel
|
|
|
|
- item.type == "channel"
|