---
- 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: Fix docker 1.13.0+ forward issue
  command: "{{ item }}"
  with_items:
    - iptables -P FORWARD ACCEPT
    - iptables-save

---
- 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: docker_install_type == "source"
  service: name=docker.socket enabled=yes state=started

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

- name: Fix docker 1.13.0+ forward issue
  command: "{{ item }}"
  with_items:
    - iptables -P FORWARD ACCEPT
    - iptables-save

Fix centos docker start fail issue
Fix centos docker start fail issue
