-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-docker.yml
50 lines (44 loc) · 1.11 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
---
- hosts: all
become: true
tasks:
- name: install dependencies
apt:
name:
- ca-certificates
- curl
- gnupg-agent
state: present
update_cache: yes
- name: Install key
block:
- name: Install key
ansible.builtin.get_url:
url: https://download.docker.com/linux/ubuntu/gpg
dest: /etc/apt/keyrings/docker.gpg
- name: Install repo
ansible.builtin.apt_repository:
repo: deb [arch=amd64 signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename|lower }} stable
state: present
- name: install docker
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: latest
update_cache: yes
- name: check docker is active
service:
name: docker
state: started
enabled: yes
- name: Ensure group "docker" exists
ansible.builtin.group:
name: docker
state: present
- name: adding admin01 to docker group
user:
name: admin01
groups: docker
append: yes