Log cleanup
[ealt-edge.git] / ocd / infra / playbooks / roles / docker / tasks / uninstall.yml
1 # Copyright 2020 Huawei Technologies Co., Ltd.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 ---
16 - name: Check whether docker is installed before deleting
17   command: which docker
18   register: result
19   ignore_errors: yes
20   no_log: True
21
22 - debug:
23     msg: Uninstalling docker...
24   when: result.stdout != ""
25
26 - debug:
27 # yamllint disable rule:line-length
28     msg: Ignore Uninstall Log , Docker not installed
29 # yamllint disable rule:line-length
30   when: result.stdout == ""
31
32 - name: "UNINSTALL: Uninstall docker engine"
33   command: apt-get purge -y docker-engine
34   ignore_errors: yes
35   when: result is succeeded and ansible_architecture == 'aarch64'
36
37 - name: "UNINSTALL: Uninstall docker"
38   command: apt-get purge -y docker
39   ignore_errors: yes
40   when: result is succeeded and ansible_architecture == 'aarch64'
41   #when: result is succeeded and ansible_architecture == 'x86_64'
42
43 - name: "UNINSTALL: Uninstall docker.io"
44   command: apt-get purge -y docker.io
45   ignore_errors: yes
46   when: result is succeeded and ansible_architecture == 'aarch64'
47
48 - name: "UNINSTALL: Uninstall docker-ce"
49   command: apt-get purge -y docker-ce
50   ignore_errors: yes
51   when: result is succeeded and ansible_architecture == 'aarch64'
52   #when: result is succeeded and ansible_architecture == 'aarch64'
53
54 - name: "UNINSTALL: Uninstall docker"
55   command: apt-get purge -y docker-ce-cli
56   ignore_errors: yes
57   when: result is succeeded and ansible_architecture == 'aarch64'
58   #when: result is succeeded
59
60 - name: "UNINSTALL: Uninstall docker engine"
61   command: apt-get purge -y docker-engine
62   ignore_errors: yes
63   no_log: true
64   when: result is succeeded and ansible_architecture == 'x86_64'
65
66 - name: "UNINSTALL: Uninstall docker"
67   command: apt-get purge -y docker
68   ignore_errors: yes
69   no_log: true
70   when: result is succeeded and ansible_architecture == 'x86_64'
71
72 - name: "UNINSTALL: Uninstall docker.io"
73   command: apt-get purge -y docker.io
74   ignore_errors: yes
75   no_log: true
76   when: result is succeeded and ansible_architecture == 'x86_64'
77
78 - name: "UNINSTALL: Uninstall docker.io"
79   command: apt-get purge docker-ce docker-ce-cli containerd.io
80   ignore_errors: yes
81   no_log: true
82   when: result is succeeded and ansible_architecture == 'x86_64'
83
84 - debug:
85     msg: "CentOS commands start"
86
87 - name: "UNINSTALL:Uninstalled docker "
88   shell:
89     cmd: yes | yum remove docker-ce docker-ce-cli containerd.io
90   ignore_errors: yes
91   no_log: true
92   when: ansible_facts['distribution'] == "CentOS"