uninstall.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. - 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. - name: Remove linux interfaces
  76. shell: ip link del "{{ item }}"
  77. changed_when: False
  78. failed_when: False
  79. with_items:
  80. - lbr0
  81. - vlinuxbr
  82. - vovsbr
  83. - shell: systemctl reset-failed
  84. changed_when: False
  85. - shell: systemctl daemon-reload
  86. changed_when: False
  87. - shell: find /var/lib/origin/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  88. changed_when: False
  89. - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  90. changed_when: False
  91. - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
  92. changed_when: False
  93. - shell: docker rm -f "{{ item }}"-master "{{ item }}"-node
  94. changed_when: False
  95. failed_when: False
  96. with_items:
  97. - openshift-enterprise
  98. - atomic-enterprise
  99. - origin
  100. - shell: docker ps -a | grep Exited | grep "{{ item }}" | awk '{print $1}'
  101. changed_when: False
  102. failed_when: False
  103. register: exited_containers_to_delete
  104. with_items:
  105. - aep3/aep
  106. - openshift3/ose
  107. - openshift/origin
  108. - shell: "docker rm {{ item.stdout_lines | join(' ') }}"
  109. changed_when: False
  110. failed_when: False
  111. with_items: "{{ exited_containers_to_delete.results }}"
  112. - shell: docker images | grep {{ item }} | awk '{ print $3 }'
  113. changed_when: False
  114. failed_when: False
  115. register: images_to_delete
  116. with_items:
  117. - registry.access.redhat.com/openshift3
  118. - registry.access.redhat.com/aep3
  119. - docker.io/openshift
  120. - shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
  121. changed_when: False
  122. failed_when: False
  123. with_items: "{{ images_to_delete.results }}"
  124. - file: path={{ item }} state=absent
  125. with_items:
  126. - "~{{ ansible_ssh_user }}/.kube"
  127. - /etc/ansible/facts.d/openshift.fact
  128. - /etc/atomic-enterprise
  129. - /etc/corosync
  130. - /etc/etcd
  131. - /etc/openshift
  132. - /etc/openshift-sdn
  133. - /etc/origin
  134. - /etc/sysconfig/atomic-enterprise-master
  135. - /etc/sysconfig/atomic-enterprise-node
  136. - /etc/sysconfig/atomic-openshift-master
  137. - /etc/sysconfig/atomic-openshift-node
  138. - /etc/sysconfig/openshift-master
  139. - /etc/sysconfig/openshift-node
  140. - /etc/sysconfig/origin-master
  141. - /etc/sysconfig/origin-node
  142. - /root/.kube
  143. - /run/openshift-sdn
  144. - /usr/share/openshift/examples
  145. - /var/lib/atomic-enterprise
  146. - /var/lib/etcd
  147. - /var/lib/openshift
  148. - /var/lib/origin
  149. - /var/lib/pacemaker
  150. - name: restart docker
  151. service: name=docker state=restarted