Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tarball upgrade #153

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions roles/rke2_common/tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,20 @@
state: absent
changed_when: false

- name: Restart rke2-server if package installed and config changed
- name: Restart rke2-server if package installed and config changed or RKE2 version changed
service:
state: restarted
name: rke2-server
when:
- ansible_facts.services["rke2-server.service"] is defined
- "ansible_facts.services['rke2-server.service'].state == 'running'"
- tmp_sha1 != previous_rke2_config.stat.checksum
- (tmp_sha1 != previous_rke2_config.stat.checksum or (rke2_version_changed | default(false)))

- name: Restart rke2-agent if package installed and config changed
- name: Restart rke2-agent if package installed and config changed or RKE2 version changed
service:
state: restarted
name: rke2-agent
when:
- ansible_facts.services["rke2-agent.service"] is defined
- "ansible_facts.services['rke2-agent.service'].state == 'running'"
- tmp_sha1 != previous_rke2_config.stat.checksum
- (tmp_sha1 != previous_rke2_config.stat.checksum or (rke2_version_changed | default(false)))
22 changes: 20 additions & 2 deletions roles/rke2_common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

- name: Include images_tarball_install.yml
include_tasks: images_tarball_install.yml
when: not installed

- name: "Check for binary tarball in {{ playbook_dir }}/tarball_install/rke2.linux-amd64.tar.gz" # noqa name[template]
stat:
Expand All @@ -21,14 +20,33 @@
delegate_to: 127.0.0.1
become: no

- name: Check for the rke2 binary
stat:
path: /usr/local/bin/rke2
register: rke2_binary

- name: If the rke2 binary exists, determine if the version is changing
when: rke2_binary.stat.exists
block:
- name: Get current RKE2 version
shell: set -o pipefail && /usr/local/bin/rke2 -v | head -n 1 | cut -d ' ' -f 3
register: installed_rke2_version
changed_when: false
args:
executable: /usr/bin/bash

- name: Determine if current version differs what what is being installed
set_fact:
rke2_version_changed: true
when: "'stdout' in installed_rke2_version and installed_rke2_version['stdout'] != install_rke2_version"

- name: SLES/Ubuntu/Tarball Installation
include_tasks: tarball_install.yml
when:
- |-
((ansible_facts['os_family'] != 'RedHat' and
ansible_facts['os_family'] != 'Rocky') or
rke2_binary_tarball_check.stat.exists )
and not installed

- name: RHEL/CentOS Installation
when:
Expand Down
Loading