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" 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. 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 }}" +}