summaryrefslogtreecommitdiffstats
path: root/roles/docker
diff options
context:
space:
mode:
Diffstat (limited to 'roles/docker')
-rw-r--r--roles/docker/defaults/main.yml5
-rw-r--r--roles/docker/handlers/main.yml3
-rw-r--r--roles/docker/tasks/main.yml11
3 files changed, 17 insertions, 2 deletions
diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml
index 6542789..f7b96f5 100644
--- a/roles/docker/defaults/main.yml
+++ b/roles/docker/defaults/main.yml
@@ -1,3 +1,6 @@
-docker_min_size: 100
docker_exclude_vgs: "{{ ands_data_vg is defined | ternary( [ ands_data_vg ], [] ) }}"
docker_lv: "docker-pool"
+
+docker_min_size: 100
+docker_max_log_size: "2m"
+docker_max_log_files: "3"
diff --git a/roles/docker/handlers/main.yml b/roles/docker/handlers/main.yml
new file mode 100644
index 0000000..43016e0
--- /dev/null
+++ b/roles/docker/handlers/main.yml
@@ -0,0 +1,3 @@
+---
+- name: restart docker
+ service: name=docker state=restarted
diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml
index e424e01..a7bd700 100644
--- a/roles/docker/tasks/main.yml
+++ b/roles/docker/tasks/main.yml
@@ -27,6 +27,15 @@
lvol: vg="{{ ansible_lvm['lvs'][docker_lv]['vg'] }}" lv="docker_lv" size="{{ docker_volume_size }}"
when: docker_volume_size is defined
-- name: stop docker
+- name: Limit size of container log files
+ ghetto_json:
+ path: "/etc/docker/daemon.json"
+ log-driver: "json-file"
+ log-opts.max-size: "{{ docker_max_log_size }}"
+ log-opts.max-file: "{{ docker_max_log_files }}"
+ notify:
+ - restart docker
+
+- name: start docker
service: name="docker" enabled=yes state=started
\ No newline at end of file