[ATMOSPHERE-382] Add openvswitch image pull for caching before upgrade (#1754)
diff --git a/roles/openvswitch/tasks/main.yml b/roles/openvswitch/tasks/main.yml
index 99de91c..002c6db 100644
--- a/roles/openvswitch/tasks/main.yml
+++ b/roles/openvswitch/tasks/main.yml
@@ -27,6 +27,21 @@
that:
- "'LimitMEMLOCK=infinity' in _openvswitch_memlock_value.stdout"
+- name: Cache openvswitch image before install or upgrade
+ block:
+ - name: Pull openvswitch image
+ ansible.builtin.command: crictl pull {{ atmosphere_images['openvswitch_vswitchd'] }}
+ register: pull_result
+ changed_when: false
+
+ - name: Verify openvswitch image pull
+ ansible.builtin.assert:
+ that:
+ - pull_result.rc == 0
+ - "'Image is up to date' in pull_result.stdout or 'Image pulled' in pull_result.stdout"
+ fail_msg: "Failed to pull openvswitch image"
+ success_msg: "Successfully pulled openvswitch image"
+
- name: Deploy Helm chart
run_once: true
delegate_to: "{{ groups['controllers'][0] }}"