upgrade_logging.yaml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. - name: Stop the Cluster
  3. include: stop_cluster.yaml
  4. - name: Upgrade logging
  5. include: install_logging.yaml
  6. vars:
  7. start_cluster: False
  8. # start ES so that we can run migrate script
  9. - command: >
  10. {{openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get dc -l component=es -o name -n {{openshift_logging_namespace}}
  11. register: es_dc
  12. check_mode: no
  13. - name: start elasticsearch
  14. oc_scale:
  15. kind: dc
  16. name: "{{object.split('/')[1]}}"
  17. namespace: "{{mktemp.stdout}}/admin.kubeconfig"
  18. replicas: 1
  19. with_items: "{{es_dc.stdout_lines}}"
  20. loop_control:
  21. loop_var: object
  22. - command: >
  23. {{ openshift.common.client_binary}} --config={{mktemp.stdout}}/admin.kubeconfig get pods -n {{openshift_logging_namespace}} -l component=es -o jsonpath='{.items[?(@.status.phase == "Running")].metadata.name}'
  24. register: running_pod
  25. until: running_pod.stdout != ''
  26. retries: 30
  27. delay: 10
  28. changed_when: no
  29. check_mode: no
  30. - name: Run upgrade script
  31. script: es_migration.sh {{openshift.common.config_base}}/logging/ca.crt {{openshift.common.config_base}}/logging/system.admin.key {{openshift.common.config_base}}/logging/system.admin.crt {{openshift_logging_es_host}} {{openshift_logging_es_port}} {{openshift_logging_namespace}}
  32. register: script_output
  33. changed_when:
  34. - script_output.rc == 0
  35. - script_output.stdout.find("skipping update_for_uuid") == -1 or script_output.stdout.find("skipping update_for_common_data_model") == -1
  36. - name: Start up rest of cluster
  37. include: start_cluster.yaml