|
@@ -7,14 +7,14 @@
|
|
|
selector: "glusterfs=deploy-heketi-{{ glusterfs_name }}-pod"
|
|
|
register: deploy_heketi_pod_check
|
|
|
|
|
|
+# deploy-heketi pod is not missing when there are one or more pods with matching labels whose 'Ready' status is True
|
|
|
- name: Check if need to deploy deploy-heketi
|
|
|
set_fact:
|
|
|
- glusterfs_heketi_deploy_is_missing: False
|
|
|
- deploy_heketi_pod: "{{ deploy_heketi_pod_check.results.results[0]['items'][0] }}"
|
|
|
- when:
|
|
|
- - "deploy_heketi_pod_check.results.results[0]['items'] | count > 0"
|
|
|
- # deploy-heketi is not missing when there are one or more pods with matching labels whose 'Ready' status is True
|
|
|
- - "deploy_heketi_pod_check.results.results[0]['items'] | lib_utils_oo_collect(attribute='status.conditions') | lib_utils_oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count > 0"
|
|
|
+ glusterfs_heketi_deploy_is_missing: "{{ heketi_pod_results_count | int == 0 or heketi_pod_results_ready_count | int == 0 }}"
|
|
|
+ vars:
|
|
|
+ heketi_pod_results: "{{ deploy_heketi_pod_check.results.results[0]['items'] }}"
|
|
|
+ heketi_pod_results_count: "{{ heketi_pod_results | count }}"
|
|
|
+ heketi_pod_results_ready_count: "{{ heketi_pod_results | lib_utils_oo_collect(attribute='status.conditions') | lib_utils_oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count }}"
|
|
|
|
|
|
- name: Check for existing heketi pod
|
|
|
oc_obj:
|
|
@@ -24,11 +24,17 @@
|
|
|
selector: "glusterfs=heketi-{{ glusterfs_name }}-pod"
|
|
|
register: heketi_pod_check
|
|
|
|
|
|
+# heketi pod is not missing when there are one or more pods with matching labels whose 'Ready' status is True
|
|
|
- name: Check if need to deploy heketi
|
|
|
set_fact:
|
|
|
- glusterfs_heketi_is_missing: False
|
|
|
- heketi_pod: "{{ heketi_pod_check.results.results[0]['items'][0] }}"
|
|
|
- when:
|
|
|
- - "heketi_pod_check.results.results[0]['items'] | count > 0"
|
|
|
- # heketi is not missing when there are one or more pods with matching labels whose 'Ready' status is True
|
|
|
- - "heketi_pod_check.results.results[0]['items'] | lib_utils_oo_collect(attribute='status.conditions') | lib_utils_oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count > 0"
|
|
|
+ glusterfs_heketi_is_missing: "{{ heketi_pod_results_count | int == 0 or heketi_pod_results_ready_count | int == 0 }}"
|
|
|
+ vars:
|
|
|
+ heketi_pod_results: "{{ heketi_pod_check.results.results[0]['items'] }}"
|
|
|
+ heketi_pod_results_count: "{{ heketi_pod_results | count }}"
|
|
|
+ heketi_pod_results_ready_count: "{{ heketi_pod_results | lib_utils_oo_collect(attribute='status.conditions') | lib_utils_oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count }}"
|
|
|
+
|
|
|
+- import_tasks: heketi_set_cli.yml
|
|
|
+ vars:
|
|
|
+ deploy_heketi_pod_results: "{{ deploy_heketi_pod_check.results.results[0]['items'] }}"
|
|
|
+ heketi_pod_results: "{{ heketi_pod_check.results.results[0]['items'] }}"
|
|
|
+ heketi_pod: "{{ heketi_pod_results | default(deploy_heketi_pod_results, true) | default([''], true) | first }}"
|