diff --git a/roles/kustomize_deploy/tasks/install_operators.yml b/roles/kustomize_deploy/tasks/install_operators.yml index eca39c58a2..ea8f35479b 100644 --- a/roles/kustomize_deploy/tasks/install_operators.yml +++ b/roles/kustomize_deploy/tasks/install_operators.yml @@ -107,6 +107,36 @@ - _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | length == 1 - (_cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources | first)['status']['installPlanRef'] is defined + - name: Retrieve the latest InstallPlan name sorted by creation date + set_fact: + installplan_name: >- + {{ + _cifmw_kustomize_deploy_olm_osp_operator_sub_out.resources + | selectattr('kind', 'equalto', 'Subscription') + | sort(attribute='metadata.creationTimestamp') + | map(attribute='status.installPlanRef.name') + | last + }} + + - debug: + msg: "{{ installplan_name }}" + + - name: Accept the InstallPlan + kubernetes.core.k8s: + api_version: operators.coreos.com/v1alpha1 + kind: InstallPlan + name: "{{ installplan_name }}" + namespace: "openstack-operators" + state: present + merge_type: + - merge + definition: + spec: + approved: true + + - debug: + msg: "========> INSTALLPLAN '{{ installplan_name }}' HAS BEEN APPROVED." + - name: Wait for the openstack operators InstallPlan to be finished vars: _install_plan: >-