summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks/delete_logging.yaml
blob: 51d6d0efde1c5563ad4f05161865080184ea78b5 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
---
# 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

# remove annotations added by logging
- command: >
    {{ openshift_client_binary }}
    --config={{ openshift.common.config_base }}/master/admin.kubeconfig
    get namespaces -o name {{ __default_logging_ops_projects | join(' ') }}
  register: __logging_ops_projects

- name: Remove Annotation of Operations Projects
  command: >
    {{ openshift_client_binary }}
    --config={{ openshift.common.config_base }}/master/admin.kubeconfig
    annotate {{ project }} openshift.io/logging.ui.hostname-
  with_items: "{{ __logging_ops_projects.stdout_lines }}"
  loop_control:
    loop_var: project
  when:
    - __logging_ops_projects.stderr | length == 0

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