blob: cd731b11eec401924a8bc4691be984c30872e8ba [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:
Bartek Grzybowskib5f99a22019-05-16 13:36:00 +020011 name: 'python-docker-py'
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010012 state: present
13
Bartek Grzybowskib5f99a22019-05-16 13:36:00 +020014
Petr Ospalý98ea8282019-03-25 13:25:45 +010015- name: Install python jsonpointer module
16 package:
17 name: 'python-jsonpointer'
18 state: present
19
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010020- name: Ensure /etc/docker exists
21 file:
22 path: /etc/docker
23 state: directory
24
Petr Ospalýf604d492019-03-04 06:56:33 +010025- name: Setup docker container logging settings
26 json_mod:
27 path: /etc/docker/daemon.json
Samuli Silviusbf6776c2019-03-25 18:46:24 +020028 key: '' # the whole JSON document per https://tools.ietf.org/html/rfc6901
Petr Ospalýf604d492019-03-04 06:56:33 +010029 # "value" must be wrapped in single quote "'" with extra space in front of "{" (ansible workaround)
30 # reference: https://stackoverflow.com/questions/31969872
31 value: ' { "log-driver": "json-file", "log-opts": { "max-size": "{{ docker.log_max_size }}", "max-file": "{{ docker.log_max_file }}" } }'
32
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010033- name: Setup docker dns settings
Petr Ospalýf604d492019-03-04 06:56:33 +010034 json_mod:
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010035 path: /etc/docker/daemon.json
36 key: dns
Petr Ospalýf604d492019-03-04 06:56:33 +010037 # "value" must be wrapped in single quote "'" with extra space in front of "[" (ansible workaround)
38 # reference: https://stackoverflow.com/questions/31969872
39 value: ' [ "{{ hostvars[groups.infrastructure[0]].cluster_ip }}" ]'
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010040 notify:
41 - Restart Docker
42
43- name: Force notified handlers to run at this point
44 meta: flush_handlers
45
46- name: Ensure docker is started
47 systemd:
48 name: docker
49 state: started
Samuli Silviusbf6776c2019-03-25 18:46:24 +020050 enabled: true