uninstall_provisioners.yaml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ---
  2. - name: stop provisioners
  3. include_tasks: stop_cluster.yaml
  4. # delete the deployment objects that we had created
  5. - name: delete provisioner api objects
  6. command: >
  7. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  8. delete {{ item }} --selector provisioners-infra -n {{ openshift_provisioners_project }} --ignore-not-found=true
  9. with_items:
  10. - dc
  11. register: delete_result
  12. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  13. # delete our old secrets
  14. - name: delete provisioner secrets
  15. command: >
  16. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  17. delete secret {{ item }} -n {{ openshift_provisioners_project }} --ignore-not-found=true
  18. with_items:
  19. - provisioners-efs
  20. ignore_errors: yes
  21. register: delete_result
  22. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  23. # delete cluster role bindings
  24. - name: delete cluster role bindings
  25. command: >
  26. {{ openshift.common.client_binary }} --config={{ mktemp.stdout }}/admin.kubeconfig
  27. delete clusterrolebindings {{ item }} -n {{ openshift_provisioners_project }} --ignore-not-found=true
  28. with_items:
  29. - run-provisioners-efs
  30. register: delete_result
  31. changed_when: delete_result.stdout.find("deleted") != -1 and delete_result.rc == 0
  32. # delete our service accounts
  33. - name: delete service accounts
  34. oc_serviceaccount:
  35. name: "{{ item }}"
  36. namespace: "{{ openshift_provisioners_project }}"
  37. state: absent
  38. with_items:
  39. - provisioners-efs