delete_logging.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. - cronjobs
  17. # return all persistent volume claims as well if purge is set
  18. - name: delete logging pvc objects
  19. oc_obj:
  20. state: absent
  21. kind: pvc
  22. namespace: "{{ openshift_logging_namespace }}"
  23. selector: "logging-infra"
  24. when:
  25. - openshift_logging_purge_logging | default(false) | bool
  26. # delete the oauthclient
  27. - name: delete oauthclient kibana-proxy
  28. oc_obj:
  29. state: absent
  30. kind: oauthclient
  31. namespace: "{{ openshift_logging_namespace }}"
  32. name: kibana-proxy
  33. # delete any image streams that we may have created
  34. - name: delete logging is
  35. oc_obj:
  36. state: absent
  37. kind: is
  38. namespace: "{{ openshift_logging_namespace }}"
  39. selector: "logging-infra=support"
  40. # delete our old secrets
  41. - name: delete logging secrets
  42. oc_secret:
  43. state: absent
  44. namespace: "{{ openshift_logging_namespace }}"
  45. name: "{{ item }}"
  46. with_items:
  47. - logging-fluentd
  48. - logging-elasticsearch
  49. - logging-kibana
  50. - logging-kibana-proxy
  51. - logging-curator
  52. - logging-mux
  53. # delete our service accounts
  54. - name: delete service accounts
  55. oc_serviceaccount:
  56. state: absent
  57. namespace: "{{ openshift_logging_namespace }}"
  58. name: "{{ item }}"
  59. with_items:
  60. - aggregated-logging-elasticsearch
  61. - aggregated-logging-kibana
  62. - aggregated-logging-curator
  63. - aggregated-logging-fluentd
  64. # delete role bindings
  65. - name: delete rolebindings
  66. oc_obj:
  67. state: absent
  68. kind: rolebinding
  69. namespace: "{{ openshift_logging_namespace }}"
  70. name: logging-elasticsearch-view-role
  71. # delete cluster role bindings
  72. - name: delete cluster role bindings
  73. oc_obj:
  74. state: absent
  75. kind: clusterrolebindings
  76. namespace: "{{ openshift_logging_namespace }}"
  77. name: rolebinding-reader
  78. # delete cluster roles
  79. - name: delete cluster roles
  80. oc_obj:
  81. state: absent
  82. kind: clusterrole
  83. namespace: "{{ openshift_logging_namespace }}"
  84. name: "{{ item }}"
  85. with_items:
  86. - rolebinding-reader
  87. - daemonset-admin
  88. - prometheus-metrics-viewer
  89. # delete our configmaps
  90. - name: delete configmaps
  91. oc_obj:
  92. state: absent
  93. kind: configmap
  94. namespace: "{{ openshift_logging_namespace }}"
  95. name: "{{ item }}"
  96. with_items:
  97. - logging-curator
  98. - logging-elasticsearch
  99. - logging-elasticsearch-ops
  100. - logging-fluentd
  101. - logging-mux
  102. # remove annotations added by logging
  103. - command: >
  104. {{ openshift_client_binary }}
  105. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  106. get namespaces -o name {{ __default_logging_ops_projects | join(' ') }}
  107. register: __logging_ops_projects
  108. - name: Remove Annotation of Operations Projects
  109. command: >
  110. {{ openshift_client_binary }}
  111. --config={{ openshift.common.config_base }}/master/admin.kubeconfig
  112. annotate {{ project }} openshift.io/logging.ui.hostname-
  113. with_items: "{{ __logging_ops_projects.stdout_lines }}"
  114. loop_control:
  115. loop_var: project
  116. when:
  117. - __logging_ops_projects.stderr | length == 0
  118. ## EventRouter
  119. - import_role:
  120. name: openshift_logging_eventrouter
  121. when:
  122. not openshift_logging_install_eventrouter | default(false) | bool
  123. # Update console config in openshift-web-console namespace
  124. - name: Remove Kibana route information from the web console config
  125. include_role:
  126. name: openshift_web_console
  127. tasks_from: update_console_config.yml
  128. vars:
  129. console_config_edits:
  130. - key: clusterInfo#loggingPublicURL
  131. value: ""
  132. when:
  133. - openshift_web_console_install | default(true) | bool