uninstall.yml 6.6 KB

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