summaryrefslogtreecommitdiffstats
path: root/roles/ansible_service_broker/tasks/remove.yml
blob: a1ac740e0e1fe5639a17b3f5c1f059a17b0d10b6 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---

- name: remove ansible-service-broker serviceaccount
  oc_serviceaccount:
    name: asb
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove ansible-service-broker client serviceaccount
  oc_serviceaccount:
    name: asb-client
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove asb-auth cluster role
  oc_clusterrole:
    state: absent
    name: asb-auth

- name: remove asb-access cluster role
  oc_clusterrole:
    state: absent
    name: asb-access

- name: Unbind admin cluster-role to asb serviceaccount
  oc_adm_policy_user:
    state: absent
    namespace: openshift-ansible-service-broker
    resource_kind: cluster-role
    resource_name: admin
    user: "system:serviceaccount:openshift-ansible-service-broker:asb"

- name: Unbind auth cluster role to asb service account
  oc_adm_policy_user:
    state: absent
    namespace: openshift-ansible-service-broker
    resource_kind: cluster-role
    resource_name: asb-auth
    user: "system:serviceaccount:openshift-ansible-service-broker:asb"

- name: Unbind asb-access role to asb-client service account
  oc_adm_policy_user:
    state: absent
    namespace: openshift-ansible-service-broker
    resource_kind: cluster-role
    resource_name: asb-access
    user: "system:serviceaccount:openshift-ansible-service-broker:asb-client"

- name: remove asb-registry auth secret
  oc_secret:
    state: absent
    name: asb-registry-auth
    namespace: openshift-ansible-service-broker

- name: remove asb-client token secret
  oc_secret:
    state: absent
    name: asb-client
    namespace: openshift-ansible-service-broker

- name: Remove etcd-auth secret
  oc_secret:
    state: absent
    name: etcd-auth-secret
    namespace: openshift-ansible-service-broker

- name: Remove broker-etcd-auth secret
  oc_secret:
    state: absent
    name: broker-etcd-auth-secret
    namespace: openshift-ansible-service-broker

- name: remove ansible-service-broker service
  oc_service:
    name: asb
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove asb-etcd service
  oc_service:
    state: absent
    name: asb-etcd
    namespace: openshift-ansible-service-broker

- name: remove etcd service
  oc_service:
    name: etcd
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove route for ansible-service-broker service
  oc_route:
    name: asb-1338
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove persistent volume claim for etcd
  oc_pvc:
    name: etcd
    namespace: openshift-ansible-service-broker
    state: absent

- name: remove Ansible Service Broker deployment config
  oc_obj:
    name: asb
    namespace: openshift-ansible-service-broker
    kind: DeploymentConfig
    state: absent

- name: remove Ansible Service Broker etcd deployment config
  oc_obj:
    name: asb-etcd
    namespace: openshift-ansible-service-broker
    kind: DeploymentConfig
    state: absent


- name: remove secret for broker auth
  oc_obj:
    name: asb-client
    namespace: openshift-ansible-service-broker
    kind: Secret
    state: absent

# TODO: saw a oc_configmap in the library, but didn't understand how to get it to do the following:
- name: remove config map for ansible-service-broker
  oc_obj:
    name: broker-config
    namespace: openshift-ansible-service-broker
    state: absent
    kind: ConfigMap

# TODO: Is this going to work?
- shell: >
    oc get apiservices.apiregistration.k8s.io/v1beta1.servicecatalog.k8s.io -n kube-service-catalog || echo "not found"
  register: get_apiservices
  changed_when: no

- name: remove broker object from the catalog
  oc_obj:
    name: ansible-service-broker
    state: absent
    kind: ClusterServiceBroker
  when: not "'not found' in get_apiservices.stdout"

- name: remove openshift-ansible-service-broker project
  oc_project:
    name: openshift-ansible-service-broker
    state: absent