Hakwit added in edge
[eliot.git] / blueprints / iotgateway / 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   when: result is succeeded and ansible_architecture == 'x86_64'
64
65 - name: "UNINSTALL: Uninstall docker"
66   command: apt-get purge -y docker
67   ignore_errors: yes
68   when: result is succeeded and ansible_architecture == 'x86_64'
69
70 - name: "UNINSTALL: Uninstall docker.io"
71   command: apt-get purge -y docker.io
72   ignore_errors: yes
73   when: result is succeeded and ansible_architecture == 'x86_64'
74
75 - name: "UNINSTALL: Uninstall docker.io"
76   command: apt-get purge docker-ce docker-ce-cli containerd.io
77   ignore_errors: yes
78   when: result is succeeded and ansible_architecture == 'x86_64'
79
80 - debug:
81     msg: "CentOS commands start"
82
83 - name: "UNINSTALL:Uninstalled docker "
84   shell:
85     cmd: yes | yum remove docker-ce docker-ce-cli containerd.io
86   ignore_errors: yes
87   no_log: true
88   when: ansible_facts['distribution'] == "CentOS"