delete_logging.yaml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ---
  2. # delete the deployment objects that we had created
  3. - name: delete logging api objects
  4. oc_obj:
  5. state: absent
  6. kind: "{{ item }}"
  7. namespace: "{{ openshift_logging_namespace }}"
  8. selector: "logging-infra"
  9. with_items:
  10. - dc
  11. - rc
  12. - svc
  13. - routes
  14. - templates
  15. - ds
  16. # return all persistent volume claims as well if purge is set
  17. - name: delete logging pvc objects
  18. oc_obj:
  19. state: absent
  20. kind: pvc
  21. namespace: "{{ openshift_logging_namespace }}"
  22. selector: "logging-infra"
  23. when:
  24. - openshift_logging_purge_logging | default(false) | bool
  25. # delete the oauthclient
  26. - name: delete oauthclient kibana-proxy
  27. oc_obj:
  28. state: absent
  29. kind: oauthclient
  30. namespace: "{{ openshift_logging_namespace }}"
  31. name: kibana-proxy
  32. # delete any image streams that we may have created
  33. - name: delete logging is
  34. oc_obj:
  35. state: absent
  36. kind: is
  37. namespace: "{{ openshift_logging_namespace }}"
  38. selector: "logging-infra=support"
  39. # delete our old secrets
  40. - name: delete logging secrets
  41. oc_secret:
  42. state: absent
  43. namespace: "{{ openshift_logging_namespace }}"
  44. name: "{{ item }}"
  45. with_items:
  46. - logging-fluentd
  47. - logging-elasticsearch
  48. - logging-kibana
  49. - logging-kibana-proxy
  50. - logging-curator
  51. - logging-mux
  52. # delete our service accounts
  53. - name: delete service accounts
  54. oc_serviceaccount:
  55. state: absent
  56. namespace: "{{ openshift_logging_namespace }}"
  57. name: "{{ item }}"
  58. with_items:
  59. - aggregated-logging-elasticsearch
  60. - aggregated-logging-kibana
  61. - aggregated-logging-curator
  62. - aggregated-logging-fluentd
  63. # delete role bindings
  64. - name: delete rolebindings
  65. oc_obj:
  66. state: absent
  67. kind: rolebinding
  68. namespace: "{{ openshift_logging_namespace }}"
  69. name: logging-elasticsearch-view-role
  70. # delete cluster role bindings
  71. - name: delete cluster role bindings
  72. oc_obj:
  73. state: absent
  74. kind: clusterrolebindings
  75. namespace: "{{ openshift_logging_namespace }}"
  76. name: rolebinding-reader
  77. # delete cluster roles
  78. - name: delete cluster roles
  79. oc_obj:
  80. state: absent
  81. kind: clusterrole
  82. namespace: "{{ openshift_logging_namespace }}"
  83. name: "{{ item }}"
  84. with_items:
  85. - rolebinding-reader
  86. - daemonset-admin
  87. - prometheus-metrics-viewer
  88. # delete our configmaps
  89. - name: delete configmaps
  90. oc_obj:
  91. state: absent
  92. kind: configmap
  93. namespace: "{{ openshift_logging_namespace }}"
  94. name: "{{ item }}"
  95. with_items:
  96. - logging-curator
  97. - logging-elasticsearch
  98. - logging-fluentd
  99. - logging-mux
  100. # remove annotations added by logging
  101. - command: >
  102. {{ openshift_client_binary }}
  103. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  104. get namespaces -o name {{ __default_logging_ops_projects | join(' ') }}
  105. register: __logging_ops_projects
  106. - name: Remove Annotation of Operations Projects
  107. command: >
  108. {{ openshift_client_binary }}
  109. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  110. annotate {{ project }} openshift.io/logging.ui.hostname-
  111. with_items: "{{ __logging_ops_projects.stdout_lines }}"
  112. loop_control:
  113. loop_var: project
  114. when:
  115. - __logging_ops_projects.stderr | length == 0
  116. ## EventRouter
  117. - include_role:
  118. name: openshift_logging_eventrouter
  119. when:
  120. not openshift_logging_install_eventrouter | default(false) | bool