f47436923c8aedc9f134e0a70f8c2b3462410bd6
[ealt-edge.git] / ocd / infra / playbooks / roles / docker / tasks / install.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 already installed
17   command: which docker
18   register: result
19   ignore_errors: yes
20   no_log: True
21
22 - debug:
23     msg: Docker is already present
24   when: result.rc == 0
25
26 - name: "Installing docker update"
27   command: apt-get update -y
28   ignore_errors: yes
29   failed_when: false
30   no_log: True
31
32 - name: "Installing docker upgrade"
33 # yamllint disable rule:line-length
34   command: apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
35 # yamllint disable rule:line-length
36   ignore_errors: yes
37
38 - name: Add repository
39   shell: curl -sL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
40
41 - name: "CA-Certificates"
42 # yamllint disable rule:line-length
43   shell: sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu  $(lsb_release -cs)  stable"
44 # yamllint disable rule:line-length
45   ignore_errors: yes
46   failed_when: false
47   no_log: True
48
49 - name: "Update....."
50   command: apt-get update -y
51   ignore_errors: yes
52   failed_when: false
53   no_log: True
54
55 - name: "Installed docker"
56   command: apt-get install -y docker-ce docker-ce-cli containerd.io
57   ignore_errors: yes