summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks/delete_logging.yaml
blob: ffed956a4aae0e6847be4148752682873eecf79d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
# delete the deployment objects that we had created
- name: delete logging api objects
  oc_obj:
    state: absent
    kind: "{{ item }}"
    namespace: "{{ openshift_logging_namespace }}"
    selector: "logging-infra"
  with_items:
    - dc
    - rc
    - svc
    - routes
    - templates
    - ds

# return all persistent volume claims as well if purge is set
- name: delete logging pvc objects
  oc_obj:
    state: absent
    kind: pvc
    namespace: "{{ openshift_logging_namespace }}"
    selector: "logging-infra"
  when:
    - openshift_logging_purge_logging | default(false) | bool

# delete the oauthclient
- name: delete oauthclient kibana-proxy
  oc_obj:
    state: absent
    kind: oauthclient
    namespace: "{{ openshift_logging_namespace }}"
    name: kibana-proxy

# delete any image streams that we may have created
- name: delete logging is
  oc_obj:
    state: absent
    kind: is
    namespace: "{{ openshift_logging_namespace }}"
    selector: "logging-infra=support"

# delete our old secrets
- name: delete logging secrets
  oc_secret:
    state: absent
    namespace: "{{ openshift_logging_namespace }}"
    name: "{{ item }}"
  with_items:
    - logging-fluentd
    - logging-elasticsearch
    - logging-kibana
    - logging-kibana-proxy
    - logging-curator
    - logging-mux

# delete our service accounts
- name: delete service accounts
  oc_serviceaccount:
    state: absent
    namespace: "{{ openshift_logging_namespace }}"
    name: "{{ item }}"
  with_items:
    - aggregated-logging-elasticsearch
    - aggregated-logging-kibana
    - aggregated-logging-curator
    - aggregated-logging-fluentd

# delete role bindings
- name: delete rolebindings
  oc_obj:
    state: absent
    kind: rolebinding
    namespace: "{{ openshift_logging_namespace }}"
    name: logging-elasticsearch-view-role

# delete cluster role bindings
- name: delete cluster role bindings
  oc_obj:
    state: absent
    kind: clusterrolebindings
    namespace: "{{ openshift_logging_namespace }}"
    name: rolebinding-reader

# delete cluster roles
- name: delete cluster roles
  oc_obj:
    state: absent
    kind: clusterrole
    namespace: "{{ openshift_logging_namespace }}"
    name: "{{ item }}"
  with_items:
    - rolebinding-reader
    - daemonset-admin
    - prometheus-metrics-viewer

# delete our configmaps
- name: delete configmaps
  oc_obj:
    state: absent
    kind: configmap
    namespace: "{{ openshift_logging_namespace }}"
    name: "{{ item }}"
  with_items:
    - logging-curator
    - logging-elasticsearch
    - logging-fluentd
    - logging-mux

## EventRouter
- include_role:
    name: openshift_logging_eventrouter
  when:
    not openshift_logging_install_eventrouter | default(false) | bool