From 8a78b38dbc9e9ee57d816d85b7b60d06d6b201df Mon Sep 17 00:00:00 2001 From: Alldino Syaman Date: Sun, 14 Sep 2025 11:34:32 +0700 Subject: [PATCH] Feat: Add verification for version upgrade --- ansible/snap-microk8s/snap-update.yaml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ansible/snap-microk8s/snap-update.yaml b/ansible/snap-microk8s/snap-update.yaml index 76edeb6..fcd294c 100644 --- a/ansible/snap-microk8s/snap-update.yaml +++ b/ansible/snap-microk8s/snap-update.yaml @@ -16,6 +16,23 @@ state: present classic: true channel: '{{ microk8s_version }}' + register: snap_update_result - name: Restart each VM - ansible.builtin.reboot: \ No newline at end of file + ansible.builtin.reboot: + when: snap_update_result.changed + + - name: Ping all hosts after reboot + ansible.builtin.ping: + register: ping_after_reboot + when: snap_update_result.changed + + - name: Check the k8s version + ansible.builtin.command: microk8s kubectl version + register: k8s_version + when: snap_update_result + + - name: Print the k8s version + ansible.builtin.debug: + var: k8s_version.stdout_lines + when: k8s_version \ No newline at end of file