Wolfgang Kulhanek
2019-04-05 1ad15d992b274aa28a3e6d3bb68a0995a432e8a3
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
# vim: set ft=ansible
---
# Implement your Workload removal tasks here
- name: remove logging cr
  k8s:
    state: absent
    definition:
      apiVersion: "logging.openshift.io/v1"
      kind: "ClusterLogging"
      metadata:
        name: "instance"
        namespace: "openshift-logging"
 
# operator nukes all pods once cr is gone
# waiting for just one to remain is a bit of a hack
- name: wait for only one pod
  k8s_facts:
    api_version: v1
    kind: Pod
    namespace: openshift-logging
  register: logging_pods
  until: logging_pods.resources | list | length <= 1
  retries: 100
  delay: 10
 
- name: logging operatorgroup
  k8s:
    state: absent
    definition:
      apiVersion: operators.coreos.com/v1
      kind: OperatorGroup
      metadata:
        name: openshift-logging-operatorgroup
        namespace: openshift-logging
 
### elastic catalog source config
- name: catalog source config
  k8s:
    state: absent
    definition:
      apiVersion: operators.coreos.com/v1
      kind: CatalogSourceConfig
      metadata:
        name: elasticsearch-operator
        namespace: openshift-marketplace
 
### elastic subscription
- name: elastic subscription
  k8s:
    state: absent
    definition:
      apiVersion: operators.coreos.com/v1alpha1
      kind: Subscription
      metadata:
        name: elasticsearch-operator
        namespace: openshift-operators
 
### logging catalog source config
- name: logging catalog source config
  k8s:
    state: absent
    definition:
      apiVersion: operators.coreos.com/v1
      kind: CatalogSourceConfig
      metadata:
        name: cluster-logging-operator
        namespace: openshift-marketplace
 
### logging subscription
- name: logging subscription
  k8s:
    state: absent
    definition:
      apiVersion: operators.coreos.com/v1alpha1
      kind: Subscription
      metadata:
        name: cluster-logging
        namespace: openshift-logging
 
- name: logging project
  k8s: 
    state: absent
    definition:
      apiVersion: v1
      kind: Namespace
      metadata:
        name: openshift-logging
 
# Leave this as the last task in the playbook.
- name: remove_workload tasks complete
  debug:
    msg: "Remove Workload tasks completed successfully."
  when: not silent|bool