delete_logging.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ---
  2. - name: stop logging
  3. include: stop_cluster.yaml
  4. # delete the deployment objects that we had created
  5. - name: delete logging api objects
  6. command: >
  7. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  8. delete {{ item }} --selector logging-infra -n {{ openshift_logging_namespace }} --ignore-not-found=true
  9. with_items:
  10. - dc
  11. - rc
  12. - svc
  13. - routes
  14. - templates
  15. - daemonset
  16. register: delete_result
  17. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  18. # delete the oauthclient
  19. - name: delete oauthclient kibana-proxy
  20. command: >
  21. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig delete oauthclient kibana-proxy --ignore-not-found=true
  22. register: delete_result
  23. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  24. # delete any image streams that we may have created
  25. - name: delete logging is
  26. command: >
  27. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  28. delete is -l logging-infra=support -n {{ openshift_logging_namespace }} --ignore-not-found=true
  29. register: delete_result
  30. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  31. # delete our old secrets
  32. - name: delete logging secrets
  33. command: >
  34. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  35. delete secret {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  36. with_items:
  37. - logging-fluentd
  38. - logging-elasticsearch
  39. - logging-kibana
  40. - logging-kibana-proxy
  41. - logging-curator
  42. ignore_errors: yes
  43. register: delete_result
  44. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  45. # delete role bindings
  46. - name: delete rolebindings
  47. command: >
  48. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  49. delete rolebinding {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  50. with_items:
  51. - logging-elasticsearch-view-role
  52. register: delete_result
  53. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  54. # delete cluster role bindings
  55. - name: delete cluster role bindings
  56. command: >
  57. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  58. delete clusterrolebindings {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  59. with_items:
  60. - rolebinding-reader
  61. register: delete_result
  62. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  63. # delete cluster roles
  64. - name: delete cluster roles
  65. command: >
  66. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  67. delete clusterroles {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  68. with_items:
  69. - rolebinding-reader
  70. register: delete_result
  71. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  72. # delete our service accounts
  73. - name: delete service accounts
  74. oc_serviceaccount:
  75. kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  76. name: "{{ item }}"
  77. namespace: "{{ openshift_logging_namespace }}"
  78. state: absent
  79. with_items:
  80. - aggregated-logging-elasticsearch
  81. - aggregated-logging-kibana
  82. - aggregated-logging-curator
  83. - aggregated-logging-fluentd
  84. # delete our roles
  85. - name: delete roles
  86. command: >
  87. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  88. delete clusterrole {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  89. with_items:
  90. - daemonset-admin
  91. register: delete_result
  92. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  93. # delete our configmaps
  94. - name: delete configmaps
  95. command: >
  96. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  97. delete configmap {{ item }} -n {{ openshift_logging_namespace }} --ignore-not-found=true
  98. with_items:
  99. - logging-curator
  100. - logging-elasticsearch
  101. - logging-fluentd
  102. register: delete_result
  103. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0