refactor(ansible): use atomic direct binary replacement for aerodrome control plane upgrade

This commit is contained in:
2026-11-02 14:18:46 -05:00
parent ceae37287b
commit 7d4d59f1ae
2 changed files with 15 additions and 12 deletions

View File

@@ -16,32 +16,35 @@
ansible.builtin.debug: ansible.builtin.debug:
msg: "Upgrading {{ inventory_hostname }} from {{ pre_k3s_ver.stdout_lines[0] }} to {{ target_k3s_version }}" msg: "Upgrading {{ inventory_hostname }} from {{ pre_k3s_ver.stdout_lines[0] }} to {{ target_k3s_version }}"
- name: Download and execute K3s binary upgrade - name: Download target K3s release binary and replace executable
ansible.builtin.shell: | ansible.builtin.shell: |
curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION={{ target_k3s_version }} sh - set -e
register: k3s_upgrade_cmd ENCODED_VER=$(echo "{{ target_k3s_version }}" | sed 's/+/%2B/g')
curl -sfL "https://github.com/k3s-io/k3s/releases/download/${ENCODED_VER}/k3s-arm64" -o /usr/local/bin/k3s.new
chmod +x /usr/local/bin/k3s.new
mv /usr/local/bin/k3s.new /usr/local/bin/k3s
register: k3s_download
- name: Ensure K3s systemd unit is active - name: Restart K3s systemd service
ansible.builtin.systemd: ansible.builtin.systemd:
name: k3s name: k3s
state: started state: restarted
enabled: true
- name: Wait for local K3s service to be active - name: Wait for K3s systemd unit to report active
ansible.builtin.command: systemctl is-active k3s ansible.builtin.command: systemctl is-active k3s
register: k3s_active register: k3s_active
until: k3s_active.stdout == "active" until: k3s_active.stdout == "active"
retries: 15 retries: 20
delay: 5 delay: 4
changed_when: false changed_when: false
- name: Wait for node to report Ready in cluster - name: Wait for upgraded node to report Ready in Kubernetes
ansible.builtin.command: kubectl get node {{ inventory_hostname }} -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' ansible.builtin.command: kubectl get node {{ inventory_hostname }} -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
delegate_to: sninfr2lnxctl01 delegate_to: sninfr2lnxctl01
register: node_ready register: node_ready
until: node_ready.stdout == "True" until: node_ready.stdout == "True"
retries: 20 retries: 30
delay: 6 delay: 5
changed_when: false changed_when: false
- name: Query post-upgrade K3s version - name: Query post-upgrade K3s version

Binary file not shown.