-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker.yml
53 lines (46 loc) · 1.07 KB
/
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
- hosts: install
gather_facts: true
become: true
tasks:
- name: basic first
tags:
- sysctl
import_tasks: docker-basic.yml
- name: get docker gpg key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker apt repo
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
state: present
- name: install docker via apt
apt:
name: "docker-ce"
update_cache: yes
- name: install software via pip
pip:
name: ["docker",
"docker-compose"]
executable: pip
- name: copy systemd unit
copy:
src: docker/docker.service
dest: /etc/systemd/system/docker.service
force: yes
owner: root
group: root
mode: 644
- name: exec restart
systemd:
name: docker.service
state: restarted
enabled: true
daemon_reload: yes
- name: add users to docker group
user:
name: '{{ item }}'
groups: docker
append: yes
with_items:
- ubuntu