cleanup_logging.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. ---
  2. - name: "Checking for logging project"
  3. command: oc get project logging
  4. register: logging_project
  5. failed_when: "'FAILED' in logging_project.stderr"
  6. tags:
  7. - cleanup
  8. - name: "Changing projects"
  9. command: oc project logging
  10. tags:
  11. - cleanup
  12. - build
  13. - name: Create temp directory for kubeconfig
  14. command: mktemp -d /tmp/openshift-ansible-XXXXXX
  15. register: mktemp
  16. changed_when: False
  17. - name: Copy the admin client config(s)
  18. command: >
  19. cp {{ openshift_master_config_dir }}/admin.kubeconfig {{ mktemp.stdout }}/admin.kubeconfig
  20. changed_when: False
  21. - name: "Changing projects"
  22. command: oc project logging
  23. tags:
  24. - cleanup
  25. - build
  26. - name: "Cleanup any previous logging infrastructure"
  27. command: oc delete --ignore-not-found all --selector logging-infra={{ item }}
  28. with_items:
  29. - kibana
  30. - fluentd
  31. - elasticsearch
  32. ignore_errors: yes
  33. tags:
  34. - cleanup
  35. - name: "Cleanup existing support infrastructure"
  36. command: oc delete --ignore-not-found all,sa,oauthclient --selector logging-infra=support
  37. ignore_errors: yes
  38. tags:
  39. - cleanup
  40. - name: "Cleanup existing secrets"
  41. command: oc delete secret logging-fluentd logging-elasticsearch logging-es-proxy logging-kibana logging-kibana-proxy logging-kibana-ops-proxy
  42. ignore_errors: yes
  43. register: clean_result
  44. failed_when: clean_result.rc == 1 and 'not found' not in clean_result.stderr
  45. tags:
  46. - cleanup
  47. - name: "Cleanup existing logging deployers"
  48. command: oc delete pods --all
  49. tags:
  50. - cleanup
  51. - name: "Make sure to remove deployer template"
  52. command: oc delete template logging-deployer-template -n openshift
  53. register: delete_ouput
  54. failed_when: delete_ouput.rc == 1 and 'exists' not in delete_ouput.stderr
  55. tags:
  56. - cleanup
  57. - name: Delete temp directory
  58. file:
  59. name: "{{ mktemp.stdout }}"
  60. state: absent
  61. changed_when: False
  62. - debug: msg="Success!"