|
@@ -11,28 +11,29 @@
|
|
#
|
|
#
|
|
# NOTE: Do NOT test by checking for presence of API resources - they do not always get cleaned up.
|
|
# NOTE: Do NOT test by checking for presence of API resources - they do not always get cleaned up.
|
|
#
|
|
#
|
|
-- name: Check if the CSV exists already
|
|
|
|
- k8s_info:
|
|
|
|
- kubeconfig: tmp/kubeconfig-ocp4
|
|
|
|
- validate_certs: no
|
|
|
|
- api_version: operators.coreos.com/v1alpha1
|
|
|
|
- kind: clusterserviceversion
|
|
|
|
- register: all_csv
|
|
|
|
-
|
|
|
|
-- name: Find the wanted CSV among all CSVs
|
|
|
|
- set_fact:
|
|
|
|
- found_csv: "{{ (all_csv | community.general.json_query(\"resources[?metadata.name == \" + desired_csv + \"]\")) }}"
|
|
|
|
- when:
|
|
|
|
- - all_csv.resources is defined
|
|
|
|
- - (all_csv.resources | length) > 0
|
|
|
|
-
|
|
|
|
-- name: Get details about the CSV if found
|
|
|
|
- set_fact:
|
|
|
|
- csv_ns: "{{ found_csv[0] | community.general.json_query('metadata.namespace') }}"
|
|
|
|
- csv_name: "{{ found_csv[0] | community.general.json_query('metadata.name') }}"
|
|
|
|
- when:
|
|
|
|
- - found_csv is defined
|
|
|
|
- - (found_csv | length) > 0
|
|
|
|
|
|
+# TODO: Maybe someday fix the JSONPath expression below. And figure out why check for a CSV.
|
|
|
|
+#- name: Check if the CSV exists already
|
|
|
|
+# k8s_info:
|
|
|
|
+# kubeconfig: tmp/kubeconfig-ocp4
|
|
|
|
+# validate_certs: no
|
|
|
|
+# api_version: operators.coreos.com/v1alpha1
|
|
|
|
+# kind: clusterserviceversion
|
|
|
|
+# register: all_csv
|
|
|
|
+#
|
|
|
|
+#- name: Find the wanted CSV among all CSVs
|
|
|
|
+# set_fact:
|
|
|
|
+# found_csv: "{{ (all_csv | community.general.json_query(\"resources[?metadata.name == \" + desired_csv + \"]\")) }}"
|
|
|
|
+# when:
|
|
|
|
+# - all_csv.resources is defined
|
|
|
|
+# - (all_csv.resources | length) > 0
|
|
|
|
+#
|
|
|
|
+#- name: Get details about the CSV if found
|
|
|
|
+# set_fact:
|
|
|
|
+# csv_ns: "{{ found_csv[0] | community.general.json_query('metadata.namespace') }}"
|
|
|
|
+# csv_name: "{{ found_csv[0] | community.general.json_query('metadata.name') }}"
|
|
|
|
+# when:
|
|
|
|
+# - found_csv is defined
|
|
|
|
+# - (found_csv | length) > 0
|
|
|
|
|
|
- name: Make sure the namespace is there
|
|
- name: Make sure the namespace is there
|
|
k8s:
|
|
k8s:
|