-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlaybook_install_docker.yml
More file actions
54 lines (45 loc) · 1.66 KB
/
Playbook_install_docker.yml
File metadata and controls
54 lines (45 loc) · 1.66 KB
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
---
- name: Installation de docker sur ubuntu
hosts: localhost
connection: local
task:
- name: Updating cache
apt:
update_cache: yes
- name: Installating required packages
apt:
- ca-certificates
- curl
- gnupg
state: latest
- name: Add Docker’s official GPG key
command: "{{ item }}"
with_items :
- sudo install -m 0755 -d /etc/apt/keyrings
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg
- sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
- sudo chmod a+r /etc/apt/keyrings/docker.gpg
- name: Seting up the repository
command: "{{ item }}"
with_items:
- echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable"
- sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Updating cache again to add repository
apt:
update_cache: yes
- name: Installating Docker engine, Docker compose and Docker CLI plugin
command: sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
notify: start-docker
- name: Adding user to Docker group
command: sudo usermod -aG docker $USER
handlers:
- name: Enabling docker
service:
name: docker
enabled: yes
- name: Starting docker service
service:
name: docker
state: started
- name: Verifying Installation
debug: msg="Docker is well installed in your machin"