---
### installs pip and docker-py to enable using ansible's docker module

-   name: Install python setup tools 
    apt: name=python-setuptools state=latest
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")
    tags: docker

-   name: Install Pypi
    easy_install: name=pip
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")
    tags: docker

-   name: Install docker-py
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")
    pip: name=docker-py

-   name: Install Docker
    apt: name=docker state=latest
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")
    tags: docker

-   name: Install Docker
    apt: name=docker.io state=latest
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")
    tags: docker

-   name: override DOCKER_OPTS to ensure that the demon listens to a tcp port
    lineinfile:  dest=/etc/default/docker state=present regexp='^DOCKER_OPTS' line='DOCKER_OPTS=\'-H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock\''
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")

-   name: Force a docker service (re)start since we don't know whether the service file override has been updated/deployed for the first time (can't register file changes from copy module???)
    service: name=docker state=restarted enabled=yes
    when: (ansible_distribution == "Ubuntu"  and ansible_distribution_version == "14.04")