Improving docker restart handler
There is a bug in docker which leads to not properly
shutdown service preventing subsequent startup.
https://github.com/moby/moby/issues/30348
This commit is preventing this problem to appear.
Change-Id: I29505610bd9954af01d73264e5414fdb2b9ac99d
Issue-ID: OOM-1735
Signed-off-by: Michal Ptacek <m.ptacek@partner.samsung.com>
diff --git a/ansible/roles/docker/handlers/docker_restart.yml b/ansible/roles/docker/handlers/docker_restart.yml
new file mode 100644
index 0000000..8feb9a9
--- /dev/null
+++ b/ansible/roles/docker/handlers/docker_restart.yml
@@ -0,0 +1,18 @@
+---
+- name: Stopping docker systemd service
+ systemd:
+ name: docker
+ state: stopped
+ enabled: true
+
+# WA for docker bug, see OOM-1735
+- name: Ensure docker.sock cleaned properly
+ file:
+ state: absent
+ path: /var/run/docker.sock
+
+- name: Starting docker systemd service
+ systemd:
+ name: docker
+ state: started
+ enabled: true
diff --git a/ansible/roles/docker/handlers/main.yml b/ansible/roles/docker/handlers/main.yml
index 5df47e8..de4a52a 100644
--- a/ansible/roles/docker/handlers/main.yml
+++ b/ansible/roles/docker/handlers/main.yml
@@ -1,6 +1,3 @@
---
- name: Restart Docker
- systemd:
- name: docker
- state: restarted
- enabled: yes
+ import_tasks: docker_restart.yml