blob: 1925d09b1c48d1f101bf5b01608dee1e7e46ac52 [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
Petr Ospalý98ea8282019-03-25 13:25:45 +010014- name: Install python jsonpointer module
15 package:
16 name: 'python-jsonpointer'
17 state: present
18
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010019- name: Ensure /etc/docker exists
20 file:
21 path: /etc/docker
22 state: directory
23
Petr Ospalýf604d492019-03-04 06:56:33 +010024- name: Setup docker container logging settings
25 json_mod:
26 path: /etc/docker/daemon.json
Samuli Silviusbf6776c2019-03-25 18:46:24 +020027 key: '' # the whole JSON document per https://tools.ietf.org/html/rfc6901
Petr Ospalýf604d492019-03-04 06:56:33 +010028 # "value" must be wrapped in single quote "'" with extra space in front of "{" (ansible workaround)
29 # reference: https://stackoverflow.com/questions/31969872
30 value: ' { "log-driver": "json-file", "log-opts": { "max-size": "{{ docker.log_max_size }}", "max-file": "{{ docker.log_max_file }}" } }'
31
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010032- name: Setup docker dns settings
Petr Ospalýf604d492019-03-04 06:56:33 +010033 json_mod:
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010034 path: /etc/docker/daemon.json
35 key: dns
Petr Ospalýf604d492019-03-04 06:56:33 +010036 # "value" must be wrapped in single quote "'" with extra space in front of "[" (ansible workaround)
37 # reference: https://stackoverflow.com/questions/31969872
38 value: ' [ "{{ hostvars[groups.infrastructure[0]].cluster_ip }}" ]'
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010039 notify:
40 - Restart Docker
41
42- name: Force notified handlers to run at this point
43 meta: flush_handlers
44
45- name: Ensure docker is started
46 systemd:
47 name: docker
48 state: started
Samuli Silviusbf6776c2019-03-25 18:46:24 +020049 enabled: true