uninstall.yml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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: ansible_pkg_mgr == "yum" and 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. - corosync
  57. - etcd
  58. - openshift
  59. - openshift-master
  60. - openshift-node
  61. - openshift-sdn
  62. - openshift-sdn-ovs
  63. - openvswitch
  64. - origin
  65. - origin-clients
  66. - origin-master
  67. - origin-node
  68. - origin-sdn-ovs
  69. - pacemaker
  70. - pcs
  71. - tuned-profiles-atomic-enterprise-node
  72. - tuned-profiles-atomic-openshift-node
  73. - tuned-profiles-openshift-node
  74. - tuned-profiles-origin-node
  75. - dnf: name={{ item }} state=absent
  76. when: ansible_pkg_mgr == "dnf" and not is_atomic | bool
  77. with_items:
  78. - atomic-enterprise
  79. - atomic-enterprise-master
  80. - atomic-enterprise-node
  81. - atomic-enterprise-sdn-ovs
  82. - atomic-openshift
  83. - atomic-openshift-clients
  84. - atomic-openshift-master
  85. - atomic-openshift-node
  86. - atomic-openshift-sdn-ovs
  87. - corosync
  88. - etcd
  89. - openshift
  90. - openshift-master
  91. - openshift-node
  92. - openshift-sdn
  93. - openshift-sdn-ovs
  94. - openvswitch
  95. - origin
  96. - origin-clients
  97. - origin-master
  98. - origin-node
  99. - origin-sdn-ovs
  100. - pacemaker
  101. - pcs
  102. - tuned-profiles-atomic-enterprise-node
  103. - tuned-profiles-atomic-openshift-node
  104. - tuned-profiles-openshift-node
  105. - tuned-profiles-origin-node
  106. - name: Remove linux interfaces
  107. shell: ip link del "{{ item }}"
  108. changed_when: False
  109. failed_when: False
  110. with_items:
  111. - lbr0
  112. - vlinuxbr
  113. - vovsbr
  114. - shell: systemctl reset-failed
  115. changed_when: False
  116. - shell: systemctl daemon-reload
  117. changed_when: False
  118. - shell: find /var/lib/origin/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  119. changed_when: False
  120. - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  121. changed_when: False
  122. - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  123. changed_when: False
  124. - shell: docker rm -f "{{ item }}"-master "{{ item }}"-node
  125. changed_when: False
  126. failed_when: False
  127. with_items:
  128. - openshift-enterprise
  129. - atomic-enterprise
  130. - origin
  131. - shell: docker ps -a | grep Exited | egrep "{{ item }}" | awk '{print $1}'
  132. changed_when: False
  133. failed_when: False
  134. register: exited_containers_to_delete
  135. with_items:
  136. - aep3.*/aep
  137. - openshift3/ose
  138. - openshift/origin
  139. - shell: "docker rm {{ item.stdout_lines | join(' ') }}"
  140. changed_when: False
  141. failed_when: False
  142. with_items: "{{ exited_containers_to_delete.results }}"
  143. - shell: docker images | egrep {{ item }} | awk '{ print $3 }'
  144. changed_when: False
  145. failed_when: False
  146. register: images_to_delete
  147. with_items:
  148. - registry\.access\..*redhat\.com/openshift3
  149. - registry\.access\..*redhat\.com/aep3
  150. - docker.io/openshift
  151. - shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
  152. changed_when: False
  153. failed_when: False
  154. with_items: "{{ images_to_delete.results }}"
  155. - file: path={{ item }} state=absent
  156. with_items:
  157. - "~{{ ansible_ssh_user }}/.kube"
  158. - /etc/ansible/facts.d/openshift.fact
  159. - /etc/atomic-enterprise
  160. - /etc/corosync
  161. - /etc/etcd
  162. - /etc/openshift
  163. - /etc/openshift-sdn
  164. - /etc/origin
  165. - /etc/sysconfig/atomic-enterprise-master
  166. - /etc/sysconfig/atomic-enterprise-node
  167. - /etc/sysconfig/atomic-openshift-master
  168. - /etc/sysconfig/atomic-openshift-master-api
  169. - /etc/sysconfig/atomic-openshift-master-controllers
  170. - /etc/sysconfig/atomic-openshift-node
  171. - /etc/sysconfig/openshift-master
  172. - /etc/sysconfig/openshift-node
  173. - /etc/sysconfig/origin-master
  174. - /etc/sysconfig/origin-master-api
  175. - /etc/sysconfig/origin-master-controllers
  176. - /etc/sysconfig/origin-node
  177. - /etc/systemd/system/atomic-openshift-node.service.wants
  178. - /root/.kube
  179. - /run/openshift-sdn
  180. - /usr/share/openshift/examples
  181. - /var/lib/atomic-enterprise
  182. - /var/lib/etcd
  183. - /var/lib/openshift
  184. - /var/lib/origin
  185. - /var/lib/pacemaker
  186. - /usr/lib/systemd/system/atomic-openshift-master-api.service
  187. - /usr/lib/systemd/system/atomic-openshift-master-controllers.service
  188. - /usr/lib/systemd/system/origin-master-api.service
  189. - /usr/lib/systemd/system/origin-master-controllers.service
  190. # Since we are potentially removing the systemd unit files for separated
  191. # master-api and master-controllers services, so we need to reload the
  192. # systemd configuration manager
  193. - name: Reload systemd manager configuration
  194. command: systemctl daemon-reload
  195. - hosts: nodes
  196. sudo: yes
  197. tasks:
  198. - name: restart docker
  199. service: name=docker state=restarted