-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinit.sls
40 lines (37 loc) · 992 Bytes
/
init.sls
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
include:
- docker.repository
# Install and configure docker
docker:
pkg.installed:
- pkgs: [docker-ce]
service.running:
- name: docker
- enable: true
- reload: {{ salt['pillar.get']('docker:reload', true) }}
- watch:
- pkg: docker
- file: /etc/docker/daemon.json
# Deploy daemon.json if options are given in pillar.
# Make sure it's not existent if not.
{% if salt['pillar.get']('docker:daemon', None) != none %}
file.serialize:
- name: /etc/docker/daemon.json
- user: root
- group: root
- mode: 644
- formatter: json
- makedirs: true
- dataset_pillar: docker:daemon
{% else %}
file.absent:
- name: /etc/docker/daemon.json
{% endif %}
# Add users to docker group, so they can access docker
{% if salt['pillar.get']('docker:users', None) != none %}
add_users_to_docker_group:
group.present:
- name: docker
- members: {{ salt['pillar.get']('docker:users') }}
- require:
- pkg: docker
{% endif %}