Skip to content
Open
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The Role can install the RKE2 in 3 modes:
---
- Additionally it is possible to install the RKE2 Cluster (all 3 modes) in Air-Gapped functionality with the use of local artifacts.

> It is possible to upgrade RKE2 by changing `rke2_version` variable and re-running the playbook with this role. During the upgrade process the RKE2 service on the nodes will be restarted one by one. The Ansible Role will check if the node on which the service was restarted is in Ready state and only then proceed with restarting service on another Kubernetes node.
> It is possible to upgrade RKE2 by re-running the playbook with this role, using the `rke2_channel` (or `rke2_version`, if `rke2_channel` is not defined). During the upgrade process the RKE2 service on the nodes will be restarted one by one. The Ansible Role will check if the node on which the service was restarted is in Ready state and only then proceed with restarting service on another Kubernetes node.

## Requirements for Anisble Controller

Expand Down Expand Up @@ -140,7 +140,7 @@ rke2_agent_node_taints: []
# Pre-shared secret token that other server or agent nodes will register with when connecting to the cluster
rke2_token: defaultSecret12345

# RKE2 version
# RKE2 version (rke2_channel overrides this!)
rke2_version: v1.25.3+rke2r1

# URL to RKE2 repository
Expand Down Expand Up @@ -190,8 +190,8 @@ rke2_architecture: amd64
# Destination directory for RKE2 installation script
rke2_install_script_dir: /var/tmp

# RKE2 channel
rke2_channel: stable
# RKE2 channel (overrides rke2_version!) - use "stable" or "latest" or a specific version - see https://update.rke2.io/v1-release/channels
# rke2_channel: stable

# Do not deploy packaged components and delete any deployed components
# Valid items: rke2-canal, rke2-coredns, rke2-ingress-nginx, rke2-metrics-server
Expand Down
6 changes: 3 additions & 3 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ rke2_agent_node_taints: []
# Pre-shared secret token that other server or agent nodes will register with when connecting to the cluster
rke2_token: defaultSecret12345

# RKE2 version
# RKE2 version (rke2_channel overrides this!)
rke2_version: v1.25.3+rke2r1

# URL to RKE2 repository
Expand Down Expand Up @@ -151,8 +151,8 @@ rke2_architecture: amd64
# Destination directory for RKE2 installation script
rke2_install_script_dir: /var/tmp

# RKE2 channel
rke2_channel: stable
# RKE2 channel (overrides rke2_version!) - use "stable" or "latest" or a specific version - see https://update.rke2.io/v1-release/channels
# rke2_channel: stable

# Do not deploy packaged components and delete any deployed components
# Valid items: rke2-canal, rke2-coredns, rke2-ingress-nginx, rke2-metrics-server
Expand Down
21 changes: 20 additions & 1 deletion tasks/rke2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,25 @@
changed_when: false
register: versions_check

- name: Get latest RKE2 version from channel
when: rke2_channel is defined
block:
- name: Get RKE2 channel json
run_once: true
delegate_to: localhost
ansible.builtin.uri:
url: "{{ rke2_channel_url }}"
method: GET
return_content: true
register: rke2_channels_response
- name: Set latest RKE2 version
ansible.builtin.set_fact:
rke2_version: "{{ rke2_channels_response.json.data | selectattr('name', 'equalto', rke2_channel) | map(attribute='latest') | first }}"
- name: Display latest RKE2 version
run_once: true
ansible.builtin.debug:
msg: "Latest RKE2 version for channel '{{ rke2_channel }}' is '{{ rke2_version }}'"

- name: Set RKE2 versions
when: not ansible_check_mode
ansible.builtin.set_fact:
Expand Down Expand Up @@ -263,7 +282,7 @@
ansible.builtin.command:
cmd: "{{ rke2_install_script_dir }}/rke2.sh"
environment:
INSTALL_RKE2_VERSION: "{{ rke2_version }}"
INSTALL_RKE2_VERSION: "{{ '' if rke2_channel is defined else rke2_version }}"
INSTALL_RKE2_CHANNEL_URL: "{{ rke2_channel_url }}"
INSTALL_RKE2_CHANNEL: "{{ rke2_channel }}"
INSTALL_RKE2_METHOD: "{{ rke2_method }}"
Expand Down