uninstall.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. # This deletes *ALL* Origin, Atomic Enterprise Platform and OpenShift
  2. # Enterprise content installed by ansible. This includes:
  3. #
  4. # configuration
  5. # containers
  6. # example templates and imagestreams
  7. # images
  8. # RPMs
  9. ---
  10. - hosts:
  11. - OSEv3:children
  12. sudo: yes
  13. tasks:
  14. - name: Detecting Operating System
  15. shell: ls /run/ostree-booted
  16. ignore_errors: yes
  17. failed_when: false
  18. register: ostree_output
  19. - set_fact:
  20. is_atomic: "{{ ostree_output.rc == 0 }}"
  21. - name: Remove br0 interface
  22. shell: ovs-vsctl del-br br0
  23. changed_when: False
  24. failed_when: False
  25. - service: name={{ item }} state=stopped
  26. with_items:
  27. - atomic-enterprise-master
  28. - atomic-enterprise-node
  29. - atomic-openshift-master
  30. - atomic-openshift-master-api
  31. - atomic-openshift-master-controllers
  32. - atomic-openshift-node
  33. - etcd
  34. - openshift-master
  35. - openshift-master-api
  36. - openshift-master-controllers
  37. - openshift-node
  38. - openvswitch
  39. - origin-master
  40. - origin-master-api
  41. - origin-master-controllers
  42. - origin-node
  43. - pcsd
  44. - yum: name={{ item }} state=absent
  45. when: not is_atomic | bool
  46. with_items:
  47. - atomic-enterprise
  48. - atomic-enterprise-master
  49. - atomic-enterprise-node
  50. - atomic-enterprise-sdn-ovs
  51. - atomic-openshift
  52. - atomic-openshift-clients
  53. - atomic-openshift-master
  54. - atomic-openshift-node
  55. - atomic-openshift-sdn-ovs
  56. - etcd
  57. - corosync
  58. - openshift
  59. - openshift-master
  60. - openshift-node
  61. - openshift-sdn
  62. - openshift-sdn-ovs
  63. - openvswitch
  64. - origin
  65. - origin-master
  66. - origin-node
  67. - origin-sdn-ovs
  68. - pacemaker
  69. - pcs
  70. - tuned-profiles-atomic-enterprise-node
  71. - tuned-profiles-atomic-openshift-node
  72. - tuned-profiles-openshift-node
  73. - tuned-profiles-origin-node
  74. - name: Remove linux interfaces
  75. shell: ip link del "{{ item }}"
  76. changed_when: False
  77. failed_when: False
  78. with_items:
  79. - lbr0
  80. - vlinuxbr
  81. - vovsbr
  82. - shell: systemctl reset-failed
  83. changed_when: False
  84. - shell: systemctl daemon-reload
  85. changed_when: False
  86. - shell: find /var/lib/origin/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  87. changed_when: False
  88. - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  89. changed_when: False
  90. - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  91. changed_when: False
  92. - shell: docker rm -f "{{ item }}"-master "{{ item }}"-node
  93. changed_when: False
  94. failed_when: False
  95. with_items:
  96. - openshift-enterprise
  97. - atomic-enterprise
  98. - origin
  99. - shell: docker ps -a | grep Exited | grep "{{ item }}" | awk '{print $1}'
  100. changed_when: False
  101. failed_when: False
  102. register: exited_containers_to_delete
  103. with_items:
  104. - aep3/aep
  105. - openshift3/ose
  106. - openshift/origin
  107. - shell: "docker rm {{ item.stdout_lines | join(' ') }}"
  108. changed_when: False
  109. failed_when: False
  110. with_items: "{{ exited_containers_to_delete.results }}"
  111. - shell: docker images | grep {{ item }} | awk '{ print $3 }'
  112. changed_when: False
  113. failed_when: False
  114. register: images_to_delete
  115. with_items:
  116. - registry.access.redhat.com/openshift3
  117. - registry.access.redhat.com/aep3
  118. - docker.io/openshift
  119. - shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
  120. changed_when: False
  121. failed_when: False
  122. with_items: "{{ images_to_delete.results }}"
  123. - file: path={{ item }} state=absent
  124. with_items:
  125. - /etc/ansible/facts.d/openshift.fact
  126. - /etc/atomic-enterprise
  127. - /etc/etcd
  128. - /etc/corosync
  129. - /etc/openshift
  130. - /etc/openshift-sdn
  131. - /etc/origin
  132. - /etc/sysconfig/atomic-enterprise-master
  133. - /etc/sysconfig/atomic-enterprise-node
  134. - /etc/sysconfig/atomic-openshift-master
  135. - /etc/sysconfig/atomic-openshift-node
  136. - /etc/sysconfig/openshift-master
  137. - /etc/sysconfig/openshift-node
  138. - /etc/sysconfig/origin-master
  139. - /etc/sysconfig/origin-node
  140. - /root/.kube
  141. - "~{{ ansible_ssh_user }}/.kube"
  142. - /usr/share/openshift/examples
  143. - /var/lib/atomic-enterprise
  144. - /var/lib/etcd
  145. - /var/lib/openshift
  146. - /var/lib/origin
  147. - /var/lib/pacemaker