---
- name: Stop docker engine service
  service: name=docker state=stopped
  when: '"docker0" in ansible_interfaces'
  register: docker_stoped

- name: Delete docker0 interface
  command: ip link delete docker0
  when: '"docker0" in ansible_interfaces'

- name: Enable and start docker socket
  service: name=docker.socket enabled=yes state=started

- name: Enable and restart docker
  service: name=docker enabled=yes state=restarted

---
- name: Stop docker engine service
  service: name=docker state=stopped
  when: '"docker0" in ansible_interfaces'
  register: docker_stoped

- name: Delete docker0 interface
  command: ip link delete docker0
  when: '"docker0" in ansible_interfaces'

- name: Enable and start docker socket
  when: ansible_os_family == "Debian"
  service: name=docker.socket enabled=yes state=started

- name: Enable and restart docker
  service: name=docker enabled=yes state=restarted

Fix docker socket broken on CentOS
Fix docker socket broken on CentOS
