summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorMichal Ptacek <m.ptacek@partner.samsung.com>2019-03-20 13:20:42 +0000
committerGerrit Code Review <gerrit@onap.org>2019-03-20 13:20:42 +0000
commit05e1ac0c20544068c1611c2c91b71f0eee4277c3 (patch)
treecb8ebc69bc3db042cb0ae929225c0e514f00de6d /ansible/roles
parent89dbe9d9ae64e238a602c6aa13564895c231dba3 (diff)
parentf604d490d97e3b580029bd4cfade324174555dc2 (diff)
Merge "Add default logging settings for docker"
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/docker/defaults/main.yml4
-rw-r--r--ansible/roles/docker/tasks/main.yml14
2 files changed, 16 insertions, 2 deletions
diff --git a/ansible/roles/docker/defaults/main.yml b/ansible/roles/docker/defaults/main.yml
new file mode 100644
index 00000000..1922f64b
--- /dev/null
+++ b/ansible/roles/docker/defaults/main.yml
@@ -0,0 +1,4 @@
+---
+docker:
+ log_max_size: 100m
+ log_max_file: 3
diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml
index 09e790a4..16b7002f 100644
--- a/ansible/roles/docker/tasks/main.yml
+++ b/ansible/roles/docker/tasks/main.yml
@@ -16,11 +16,21 @@
path: /etc/docker
state: directory
+- name: Setup docker container logging settings
+ json_mod:
+ path: /etc/docker/daemon.json
+ key: '' # the whole JSON document per https://tools.ietf.org/html/rfc6901
+ # "value" must be wrapped in single quote "'" with extra space in front of "{" (ansible workaround)
+ # reference: https://stackoverflow.com/questions/31969872
+ value: ' { "log-driver": "json-file", "log-opts": { "max-size": "{{ docker.log_max_size }}", "max-file": "{{ docker.log_max_file }}" } }'
+
- name: Setup docker dns settings
- json_add:
+ json_mod:
path: /etc/docker/daemon.json
key: dns
- value: "{{ hostvars[groups.infrastructure[0]].cluster_ip }}"
+ # "value" must be wrapped in single quote "'" with extra space in front of "[" (ansible workaround)
+ # reference: https://stackoverflow.com/questions/31969872
+ value: ' [ "{{ hostvars[groups.infrastructure[0]].cluster_ip }}" ]'
notify:
- Restart Docker