remove.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ---
  2. - name: Unbind admin cluster-role to asb serviceaccount
  3. oc_adm_policy_user:
  4. state: absent
  5. namespace: openshift-ansible-service-broker
  6. resource_kind: cluster-role
  7. resource_name: admin
  8. user: "system:serviceaccount:openshift-ansible-service-broker:asb"
  9. - name: Unbind auth cluster role to asb service account
  10. oc_adm_policy_user:
  11. state: absent
  12. namespace: openshift-ansible-service-broker
  13. resource_kind: cluster-role
  14. resource_name: asb-auth
  15. user: "system:serviceaccount:openshift-ansible-service-broker:asb"
  16. - name: Unbind asb-access role to asb-client service account
  17. oc_adm_policy_user:
  18. state: absent
  19. namespace: openshift-ansible-service-broker
  20. resource_kind: cluster-role
  21. resource_name: asb-access
  22. user: "system:serviceaccount:openshift-ansible-service-broker:asb-client"
  23. - name: remove ansible-service-broker serviceaccount
  24. oc_serviceaccount:
  25. name: asb
  26. namespace: openshift-ansible-service-broker
  27. state: absent
  28. - name: remove ansible-service-broker client serviceaccount
  29. oc_serviceaccount:
  30. name: asb-client
  31. namespace: openshift-ansible-service-broker
  32. state: absent
  33. - name: remove asb-auth cluster role
  34. oc_clusterrole:
  35. state: absent
  36. name: asb-auth
  37. - name: remove asb-access cluster role
  38. oc_clusterrole:
  39. state: absent
  40. name: asb-access
  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 ansible-service-broker service
  52. oc_service:
  53. name: asb
  54. namespace: openshift-ansible-service-broker
  55. state: absent
  56. - name: remove route for ansible-service-broker service
  57. oc_route:
  58. name: asb-1338
  59. namespace: openshift-ansible-service-broker
  60. state: absent
  61. - name: remove route for dashboard-redirector service
  62. oc_route:
  63. name: dr-1337
  64. namespace: openshift-ansible-service-broker
  65. state: absent
  66. when: ansible_service_broker_enable_dashboard_redirector
  67. - name: remove Ansible Service Broker deployment config
  68. oc_obj:
  69. name: asb
  70. namespace: openshift-ansible-service-broker
  71. kind: DeploymentConfig
  72. state: absent
  73. - name: remove secret for broker auth
  74. oc_obj:
  75. name: asb-client
  76. namespace: openshift-ansible-service-broker
  77. kind: Secret
  78. state: absent
  79. - name: remove config map for ansible-service-broker
  80. oc_configmap:
  81. name: broker-config
  82. namespace: openshift-ansible-service-broker
  83. state: absent
  84. - name: remove custom resource definitions for asb
  85. oc_obj:
  86. name: '{{ asb_crd.metadata.name }}'
  87. kind: CustomResourceDefinition
  88. state: absent
  89. vars:
  90. asb_crd: "{{ lookup('file', item) | from_yaml }}"
  91. with_fileglob:
  92. - 'files/*.automationbroker.io.yaml'
  93. # TODO: Is this going to work?
  94. - shell: >
  95. oc get apiservices.apiregistration.k8s.io/v1beta1.servicecatalog.k8s.io -n kube-service-catalog || echo "not found"
  96. register: get_apiservices
  97. changed_when: no
  98. - name: remove broker object from the catalog
  99. oc_obj:
  100. name: ansible-service-broker
  101. state: absent
  102. kind: ClusterServiceBroker
  103. when: not "'not found' in get_apiservices.stdout"
  104. - name: remove openshift-ansible-service-broker project
  105. oc_project:
  106. name: openshift-ansible-service-broker
  107. state: absent