-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker_install_on_ubuntu.yaml
57 lines (48 loc) · 1.38 KB
/
docker_install_on_ubuntu.yaml
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
---
- name: "Docker Installation on Ubuntu"
hosts: ubuntu
tasks:
- name: Update all packages
apt:
name: '*'
update_cache: yes
state: latest
- name: Install dependencies
apt:
name: "{{ item }}"
state: latest
update_cache: yes
loop:
- ca-certificates
- apt-transport-https
- gnupg
- lsb-release
- name: Add gpg key
apt_key:
url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
state: present
- name: Add repository into sources list
apt_repository:
repo: "deb [arch={{ ansible_architecture }}] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present
filename: docker
- name: Install docker and docker-compose
apt:
name:
- docker
- docker-compose
state: latest
- name: Enable Docker service at startup
service:
name: docker
state: started
enabled: yes
# - name: Create "docker" group
# group:
# name: docker
# state: present
# - name: Add remote "ubuntu" user to "docker" group
# user:
# name: "{{ ansible_user }}"
# group: docker
# append: yes