f75648959263fcc9535f45a4b6a5563a8423372f
[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 - debug:
61     msg: "CentOS commands start"
62
63 - name: "UNINSTALL:Uninstalled docker "
64   shell:
65     cmd: yes | yum remove docker-ce docker-ce-cli containerd.io
66   ignore_errors: yes
67   no_log: true