forked from tranductrinh/k8s
-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
58 lines (48 loc) · 1.36 KB
/
playbook.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
---
- hosts: all
name: Install Docker
remote_user: ci
become: yes
tasks:
# https://docs.docker.com/engine/install/ubuntu/#installation-methods
- name: Install packages to allow apt to use a repository over HTTPS
apt:
name:
- ca-certificates
- gnupg
- apt-transport-https
state: present
update_cache: yes
- name: Add Docker’s official GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Get Ubuntu release version
shell: lsb_release -cs
register: ubuntu_version
- name: Get architecture
shell: dpkg --print-architecture
register: architecture
- name: Add Docker repository
apt_repository:
repo: "deb [arch={{ architecture.stdout }}] https://download.docker.com/linux/ubuntu {{ ubuntu_version.stdout }} stable"
state: present
filename: docker
- name: Update apt packages
apt:
update_cache: "yes"
force_apt_get: "yes"
- name: Install Docker engine
apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
update_cache: yes
- name: Add current user to docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: yes
become: yes