Tomáš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 1 | --- |
| 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 Grzybowski | b5f99a2 | 2019-05-16 13:36:00 +0200 | [diff] [blame] | 11 | name: 'python-docker-py' |
Tomáš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 12 | state: present |
| 13 | |
Bartek Grzybowski | b5f99a2 | 2019-05-16 13:36:00 +0200 | [diff] [blame] | 14 | |
Petr Ospalý | 98ea828 | 2019-03-25 13:25:45 +0100 | [diff] [blame] | 15 | - name: Install python jsonpointer module |
| 16 | package: |
| 17 | name: 'python-jsonpointer' |
| 18 | state: present |
| 19 | |
Tomáš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 20 | - name: Ensure /etc/docker exists |
| 21 | file: |
| 22 | path: /etc/docker |
| 23 | state: directory |
| 24 | |
Petr Ospalý | f604d49 | 2019-03-04 06:56:33 +0100 | [diff] [blame] | 25 | - name: Setup docker container logging settings |
| 26 | json_mod: |
| 27 | path: /etc/docker/daemon.json |
Samuli Silvius | bf6776c | 2019-03-25 18:46:24 +0200 | [diff] [blame] | 28 | key: '' # the whole JSON document per https://tools.ietf.org/html/rfc6901 |
Petr Ospalý | f604d49 | 2019-03-04 06:56:33 +0100 | [diff] [blame] | 29 | # "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áš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 33 | - name: Setup docker dns settings |
Petr Ospalý | f604d49 | 2019-03-04 06:56:33 +0100 | [diff] [blame] | 34 | json_mod: |
Tomáš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 35 | path: /etc/docker/daemon.json |
| 36 | key: dns |
Petr Ospalý | f604d49 | 2019-03-04 06:56:33 +0100 | [diff] [blame] | 37 | # "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áš Levora | a1d3e82 | 2018-12-19 15:39:22 +0100 | [diff] [blame] | 40 | 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 Silvius | bf6776c | 2019-03-25 18:46:24 +0200 | [diff] [blame] | 50 | enabled: true |