angstwad/docker.ubuntu

Docker dependency errors when using docker_image on Ubuntu 14.04

Closed this issue · 3 comments

Unable to use the docker_image Ansible module:

Ansible:

ansible --version
ansible 2.3.0.0
  config file = ./ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Dec 17 2016, 23:03:43) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]

Role: angstwad.docker_ubuntu v2.4.2
OS:

NAME="Ubuntu"
VERSION="14.04.5 LTS, Trusty Tahr"

Docker:

docker --version
Docker version 17.05.0-ce, build 89658be
pip list --format=legacy | grep dock
docker (2.2.1)
docker-compose (1.13.0)
docker-pycreds (0.2.1)
dockerpty (0.4.1)

meta:

---
dependencies:
  - { role: angstwad.docker_ubuntu, become: yes, tags: [docker] }

playbook snippet:

---
# file: roles/quexs/tasks/main.yml

- name: pull quexs image from DockerHub
  docker_image:
    name: "{{ docker_image | default ('acspri/quexs') }}"
    state: "{{ docker_image_state | default('present') }}"
    tag: "{{ docker_image_tag | default('remotelime') }}"
  tags: [docker_image]

Output:

TASK [quexs : pull quexs image from DockerHub] *********************************
task path: ../roles/quexs/tasks/main.yml:8
Tuesday 09 May 2017  13:37:07 -0400 (0:00:00.033)       0:00:43.390 ***********
fatal: [quexs_test]: FAILED! => {"changed": false, "failed": true, "msg": "Failed to import docker-py - No module named docker. Try `pip install docker-py`"}

Previously when this issue had occurred #135, I was able to workaround by purposefully pinning docker-compose and docker-py to older versions. I know that prior to Ansible 2.3 this was a
known issue as well ansible/ansible/issues/20492, and that docker-py is now docker and that ansible 2.3 should now work correctly with docker-py 2.0+ per ansible/ansible/pull/19633. I have tried pinning versions again as suggested elsewhere for angstwad.docker_ubuntu users but to no avail. I have removed all pip packages, built fresh instances to test different lower pinned versions etc. I have been going mad over this especially since I have been able to use the docker_image and docker_container Ansible modules in other playbooks as well, hoping someone else has also seen this or I am missing something very obvious.

for now I am just ensuring that I use v2.2.3 of angstwad.docker_ubuntu and make sure to pin

pip_version_docker_py: '1.10.6'
pip_version_docker_compose: '1.9.0'

I want to spend more time understanding exactly why I was having issues on v2.4.2 but was rather blocked by this so will need to circle back at a later point.

FYI, this also happens for me on Ansible 2.2.x. @shanedroid 's solution did the trick. Thanks!

this issue appears to be resolved from https://github.com/angstwad/docker.ubuntu/tree/v2.3.0 onward, I was able to update to latest release of the role with ansible 2.4.3.0 with no issues. 😀