feat: add prevent downgrades check in k3s ansible
Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
4 files changed
+23
-2
No files matched your search
@@ -1,5 +1,4 @@
|
||||
---
|
||||
# https://github.com/k3s-io/k3s/issues/1971
|
||||
- name: Cruft
|
||||
block:
|
||||
- name: Cruft | Get list of custom manifests
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Version Check
|
||||
block:
|
||||
- name: Get deployed k3s version
|
||||
ansible.builtin.command: k3s --version
|
||||
register: k3s_version
|
||||
changed_when: false
|
||||
failed_when: false
|
||||
|
||||
- name: Extract k3s version
|
||||
ansible.builtin.set_fact:
|
||||
current_k3s_version: "{{ k3s_version.stdout | regex_replace('(?im)k3s version (?P<version>[a-z0-9\\.\\+]+).*\n.*', '\\g<version>') }}"
|
||||
|
||||
- name: Check if upgrades are allowed
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- "k3s_release_version is version(current_k3s_version, '>=')"
|
||||
fail_msg: "Unable to upgrade k3s because the deployed version is higher than the one specified in the configuration"
|
||||
Reference in new issue
Block a user