---
# Install docker-py in order to use ansible docker modules
- name: install pip
  yum: pkg=python-pip state=latest
- name: install centos docker io
  yum: pkg=docker-io state=latest
  when: ansible_distribution == "CentOS"
- name: install amazon linux docker io
  yum: pkg=docker state=latest
  when: ansible_distribution == "Amazon"
- name: install docker-py
  pip: name=docker-py state=present version=1.1.0 #for constants, ansible needs update
- name: upgrade six - to fix errors bug
  pip: name=six state=latest
- name: start docker
  service: name=docker enabled=yes state=started
- name: get docker api version
  #shell: docker version | grep "Server API" | cut -d " " -f 4
  shell: docker version | grep "Server API" | rev | cut -d " " -f 1 | rev
  register: docker_server_api_version
- debug: msg="DOCKER VERSION INFO - {{ docker_server_api_version.stdout }}"

---
# Install docker-py in order to use ansible docker modules
- name: install pip
  yum: pkg=python-pip state=latest
- name: install centos docker io
  yum: pkg=docker-io state=latest
  when: ansible_distribution == "CentOS"
- name: install amazon linux docker io
  yum: pkg=docker state=latest
  when: ansible_distribution == "Amazon"
- name: install docker-py
  pip: name=docker-py state=present version=1.7.0
- name: upgrade six - to fix errors bug
  pip: name=six state=latest
- name: start docker
  service: name=docker enabled=yes state=started
- name: get docker api version
  #shell: docker version | grep "Server API" | cut -d " " -f 4
  sudo: yes
  shell: docker version | grep "Server API" | rev | cut -d " " -f 1 | rev
  register: docker_server_api_version
- debug: msg="DOCKER VERSION INFO - {{ docker_server_api_version.stdout }}"

Upgrade docker-py version for ansible 2+
Upgrade docker-py version for ansible 2+
