remove.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ---
  2. - name: remove ansible-service-broker serviceaccount
  3. oc_serviceaccount:
  4. name: asb
  5. namespace: openshift-ansible-service-broker
  6. state: absent
  7. - name: remove ansible-service-broker client serviceaccount
  8. oc_serviceaccount:
  9. name: asb-client
  10. namespace: openshift-ansible-service-broker
  11. state: absent
  12. - name: remove asb-auth cluster role
  13. oc_clusterrole:
  14. state: absent
  15. name: asb-auth
  16. - name: remove asb-access cluster role
  17. oc_clusterrole:
  18. state: absent
  19. name: asb-access
  20. - name: Unbind admin cluster-role to asb serviceaccount
  21. oc_adm_policy_user:
  22. state: absent
  23. namespace: openshift-ansible-service-broker
  24. resource_kind: cluster-role
  25. resource_name: admin
  26. user: "system:serviceaccount:openshift-ansible-service-broker:asb"
  27. - name: Unbind auth cluster role to asb service account
  28. oc_adm_policy_user:
  29. state: absent
  30. namespace: openshift-ansible-service-broker
  31. resource_kind: cluster-role
  32. resource_name: asb-auth
  33. user: "system:serviceaccount:openshift-ansible-service-broker:asb"
  34. - name: Unbind asb-access role to asb-client service account
  35. oc_adm_policy_user:
  36. state: absent
  37. namespace: openshift-ansible-service-broker
  38. resource_kind: cluster-role
  39. resource_name: asb-access
  40. user: "system:serviceaccount:openshift-ansible-service-broker:asb-client"
  41. - name: remove asb-registry auth secret
  42. oc_secret:
  43. state: absent
  44. name: asb-registry-auth
  45. namespace: openshift-ansible-service-broker
  46. - name: remove asb-client token secret
  47. oc_secret:
  48. state: absent
  49. name: asb-client
  50. namespace: openshift-ansible-service-broker
  51. - name: Remove etcd-auth secret
  52. oc_secret:
  53. state: absent
  54. name: etcd-auth-secret
  55. namespace: openshift-ansible-service-broker
  56. - name: Remove broker-etcd-auth secret
  57. oc_secret:
  58. state: absent
  59. name: broker-etcd-auth-secret
  60. namespace: openshift-ansible-service-broker
  61. - name: remove ansible-service-broker service
  62. oc_service:
  63. name: asb
  64. namespace: openshift-ansible-service-broker
  65. state: absent
  66. - name: remove asb-etcd service
  67. oc_service:
  68. state: absent
  69. name: asb-etcd
  70. namespace: openshift-ansible-service-broker
  71. - name: remove etcd service
  72. oc_service:
  73. name: etcd
  74. namespace: openshift-ansible-service-broker
  75. state: absent
  76. - name: remove route for ansible-service-broker service
  77. oc_route:
  78. name: asb-1338
  79. namespace: openshift-ansible-service-broker
  80. state: absent
  81. - name: remove persistent volume claim for etcd
  82. oc_pvc:
  83. name: etcd
  84. namespace: openshift-ansible-service-broker
  85. state: absent
  86. - name: remove Ansible Service Broker deployment config
  87. oc_obj:
  88. name: asb
  89. namespace: openshift-ansible-service-broker
  90. kind: DeploymentConfig
  91. state: absent
  92. - name: remove Ansible Service Broker etcd deployment config
  93. oc_obj:
  94. name: asb-etcd
  95. namespace: openshift-ansible-service-broker
  96. kind: DeploymentConfig
  97. state: absent
  98. - name: remove secret for broker auth
  99. oc_obj:
  100. name: asb-client
  101. namespace: openshift-ansible-service-broker
  102. kind: Secret
  103. state: absent
  104. # TODO: saw a oc_configmap in the library, but didn't understand how to get it to do the following:
  105. - name: remove config map for ansible-service-broker
  106. oc_obj:
  107. name: broker-config
  108. namespace: openshift-ansible-service-broker
  109. state: absent
  110. kind: ConfigMap
  111. # TODO: Is this going to work?
  112. - shell: >
  113. oc get apiservices.apiregistration.k8s.io/v1beta1.servicecatalog.k8s.io -n kube-service-catalog || echo "not found"
  114. register: get_apiservices
  115. changed_when: no
  116. - name: remove broker object from the catalog
  117. oc_obj:
  118. name: ansible-service-broker
  119. state: absent
  120. kind: ClusterServiceBroker
  121. when: not "'not found' in get_apiservices.stdout"
  122. - name: remove openshift-ansible-service-broker project
  123. oc_project:
  124. name: openshift-ansible-service-broker
  125. state: absent