get_es_version.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. ---
  2. - oc_obj:
  3. state: list
  4. kind: pod
  5. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  6. selector: component=es
  7. register: pod_list
  8. - set_fact:
  9. available_pod: "{{ item.metadata.name }}"
  10. with_items: "{{ pod_list.results.results[0]['items'] }}"
  11. when:
  12. - pod_list.results.results is defined
  13. - item.status.phase == "Running"
  14. - item.status.containerStatuses[0].ready == true
  15. - item.status.containerStatuses[1].ready == true
  16. - name: "Getting ES version for logging-es cluster"
  17. command: >
  18. {{ openshift_client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig exec {{ available_pod }} -c elasticsearch -n {{ openshift_logging_elasticsearch_namespace }} -- {{ __es_local_curl }} -XGET 'https://localhost:9200/'
  19. register: _curl_output
  20. when: available_pod is defined
  21. - oc_obj:
  22. state: list
  23. kind: pod
  24. namespace: "{{ openshift_logging_elasticsearch_namespace }}"
  25. selector: component=es-ops
  26. register: ops_pod_list
  27. - set_fact:
  28. available_ops_pod: "{{ item.metadata.name }}"
  29. with_items: "{{ ops_pod_list.results.results[0]['items'] }}"
  30. when:
  31. - ops_pod_list.results.results is defined
  32. - item.status.phase == "Running"
  33. - item.status.containerStatuses[0].ready == true
  34. - item.status.containerStatuses[1].ready == true
  35. - name: "Getting ES version for logging-es-ops cluster"
  36. command: >
  37. {{ openshift_client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig exec {{ available_ops_pod }} -c elasticsearch -n {{ openshift_logging_elasticsearch_namespace }} -- {{ __es_local_curl }} -XGET 'https://localhost:9200/'
  38. register: _ops_curl_output
  39. when: available_ops_pod is defined
  40. - set_fact:
  41. _es_output: "{{ _curl_output.stdout | from_json }}"
  42. when: _curl_output.stdout is defined
  43. - set_fact:
  44. _es_ops_output: "{{ _ops_curl_output.stdout | from_json }}"
  45. when: _ops_curl_output.stdout is defined
  46. - set_fact:
  47. _es_installed_version: "{{ _es_output.version.number }}"
  48. when:
  49. - _es_output is defined
  50. - _es_output.version is defined
  51. - _es_output.version.number is defined
  52. - set_fact:
  53. _es_ops_installed_version: "{{ _es_ops_output.version.number }}"
  54. when:
  55. - _es_ops_output is defined
  56. - _es_ops_output.version is defined
  57. - _es_ops_output.version.number is defined