From ce3eb41cea4f68d28b8b2887ea97b5bd634e2339 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Fri, 11 Dec 2020 17:24:47 +0100 Subject: [PATCH 1/3] Add default values for docker config vars --- roles/docker/defaults/main.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 roles/docker/defaults/main.yml diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml new file mode 100644 index 0000000..40dc492 --- /dev/null +++ b/roles/docker/defaults/main.yml @@ -0,0 +1,4 @@ +docker_compose_version: "1.25.4" +docker_compose_path: /usr/local/bin/docker-compose +docker_data_root: "/var/lib/docker" +docker_storage_driver: "overlay2" From 16200bf4119eff61dcd180291911dd60156046a1 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Fri, 11 Dec 2020 17:24:57 +0100 Subject: [PATCH 2/3] Add template for daemon.json --- roles/docker/templates/daemon.json.j2 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 roles/docker/templates/daemon.json.j2 diff --git a/roles/docker/templates/daemon.json.j2 b/roles/docker/templates/daemon.json.j2 new file mode 100644 index 0000000..ee43392 --- /dev/null +++ b/roles/docker/templates/daemon.json.j2 @@ -0,0 +1,9 @@ +{ + "exec-opts": ["native.cgroupdriver=systemd"], + "log-driver": "json-file", + "log-opts": { + "max-size": "100m" + }, + "data-root": "{{ docker_data_root }}", + "storage-driver": "{{ docker_storage_driver }}" +} From 2203abeaf6983767d14502208586adcb4138c8c2 Mon Sep 17 00:00:00 2001 From: Stefan Haun Date: Fri, 11 Dec 2020 17:25:08 +0100 Subject: [PATCH 3/3] Allow to set data root and storage driver for docker --- roles/docker/tasks/main.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index e232eb1..b2e0685 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -45,16 +45,9 @@ - python-docker - name: Set docker configuration - copy: + template: + src: templates/daemon.json.j2 dest: /etc/docker/daemon.json - content: | - { - "exec-opts": ["native.cgroupdriver=systemd"], - "log-driver": "json-file", - "log-opts": { - "max-size": "100m" - } - } notify: restart docker - name: Check current docker-compose version.