-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker.yml
73 lines (62 loc) · 1.69 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
- name: get docker gpg key
become: true
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: add docker apt repo
become: true
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
state: present
- name: install docker via apt
become: true
apt:
name: "docker-ce"
update_cache: yes
- name: install software via pip
become: true
pip:
name: ["docker-compose"]
executable: pip
- name: copy docker config
become: true
copy:
src: docker/daemon.json
dest: /etc/docker/daemon.json
force: yes
owner: root
group: root
mode: 644
- name: exec restart
become: true
systemd:
name: docker.service
state: restarted
enabled: true
daemon_reload: yes
- name: add users to docker group
become: true
user:
name: '{{ item }}'
groups: docker
append: yes
with_items:
- ubuntu
- meta: reset_connection
- name: copy config
become: true
copy:
src: docker/config.json
dest: /home/ubuntu/.docker/
force: yes
owner: ubuntu
group: ubuntu
mode: 0660
- name: create default gw
become: true
shell: docker network create --opt com.docker.network.bridge.name=docker_gwbridge --opt com.docker.network.bridge.enable_icc=false --opt com.docker.network.bridge.enable_ip_masquerade=true --opt com.docker.network.driver.mtu=1400 docker_gwbridge
- name: install swarm
shell: docker swarm init
- name: create network
shell: docker network create -d overlay --attachable --opt com.docker.network.driver.mtu=1400 showcase