-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_docker.yml
68 lines (58 loc) · 1.59 KB
/
install_docker.yml
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
---
- name: Install Docker
hosts: all
become: true
tasks:
- name: Remove existing Docker packages
apt:
name:
- docker.io
- docker-doc
- docker-compose
- docker-compose-v2
- podman-docker
- containerd
- runc
state: absent
# ignore_errors: yes # Ignore errors if packages are not installed
- name: Update apt package index
apt:
update_cache: yes
- name: Install required packages for adding the GPG key
apt:
name:
- ca-certificates
- curl
- gnupg
state: present
- name: Create keyrings directory
file:
path: /etc/apt/keyrings
state: directory
mode: '0755'
- name: Add Docker's official GPG key
get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.asc
mode: '0644'
- name: Add Docker's official APT repository
apt_repository:
repo: "deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu jammy stable"
state: present
- name: Update apt package index again
apt:
update_cache: yes
- name: Install Docker and related packages
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
state: latest
- name: Ensure Docker service is running
service:
name: docker
state: started
enabled: yes