summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/atomic_openshift_tutorial_reset.yml
blob: 91159ad8e3b915f7b83784dfbe4867894f7fab94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This deletes *ALL* Docker images, and uninstalls OpenShift and
# Atomic Enterprise RPMs.  It is primarily intended for use
# with the tutorial as well as for developers to reset state.

- hosts:
    - OSEv3:children

  sudo: yes

  tasks:
    - service: name={{ item }} state=stopped
      with_items:
        - openshift-master
        - openshift-node
        - openvswitch
        - atomic-enterprise-master
        - atomic-enterprise-node

    - yum: name={{ item }} state=absent
      with_items:
        - openvswitch
        - atomic-enterprise
        - atomic-enterprise-master
        - atomic-enterprise-node
        - atomic-enterprise-sdn-ovs
        - tuned-profiles-atomic-enterprise-node
        - openshift
        - openshift-master
        - openshift-node
        - openshift-sdn-ovs
        - tuned-profiles-openshift-node

    - shell: systemctl reset-failed
      changed_when: False

    - shell: systemctl daemon-reload
      changed_when: False

    - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
      changed_when: False

    - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
      changed_when: False

    - shell: docker ps -a -q | xargs docker stop
      changed_when: False

    - shell: docker ps -a -q| xargs docker rm
      changed_when: False

    - shell:  docker images -q |xargs docker rmi
      changed_when: False

    - file: path={{ item }} state=absent
      with_items:
        - /var/lib/atomic-enterprise
        - /etc/sysconfig/atomic-enterprise
        - /etc/atomic-enterprise
        - /etc/openshift
        - /etc/openshift-sdn
        - /root/.kube
        - /etc/sysconfig/openshift
        - /var/lib/openshift

    - user: name={{ item }} state=absent remove=yes
      with_items:
        - alice
        - joe