blob: 16b7002fd5ecf39519477dbdb6793675a6de0715 [file] [log] [blame]
Tomáš Levoraa1d3e822018-12-19 15:39:22 +01001---
2- name: Install docker
3 package:
4 name: 'docker-ce'
5 state: present
6 notify:
7 - Restart Docker
8
9- name: Install docker python module
10 package:
11 name: 'python2-docker'
12 state: present
13
14- name: Ensure /etc/docker exists
15 file:
16 path: /etc/docker
17 state: directory
18
Petr Ospalýf604d492019-03-04 06:56:33 +010019- name: Setup docker container logging settings
20 json_mod:
21 path: /etc/docker/daemon.json
22 key: '' # the whole JSON document per https://tools.ietf.org/html/rfc6901
23 # "value" must be wrapped in single quote "'" with extra space in front of "{" (ansible workaround)
24 # reference: https://stackoverflow.com/questions/31969872
25 value: ' { "log-driver": "json-file", "log-opts": { "max-size": "{{ docker.log_max_size }}", "max-file": "{{ docker.log_max_file }}" } }'
26
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010027- name: Setup docker dns settings
Petr Ospalýf604d492019-03-04 06:56:33 +010028 json_mod:
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010029 path: /etc/docker/daemon.json
30 key: dns
Petr Ospalýf604d492019-03-04 06:56:33 +010031 # "value" must be wrapped in single quote "'" with extra space in front of "[" (ansible workaround)
32 # reference: https://stackoverflow.com/questions/31969872
33 value: ' [ "{{ hostvars[groups.infrastructure[0]].cluster_ip }}" ]'
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010034 notify:
35 - Restart Docker
36
37- name: Force notified handlers to run at this point
38 meta: flush_handlers
39
40- name: Ensure docker is started
41 systemd:
42 name: docker
43 state: started
44 enabled: yes