0

I'm using Ansible 1.7 (devel) and Docker 0.9.1 build 3600720, and I'm stuck with this error:

failed: [myapp.com] => {"failed": true, "item": "", "parsed": false}
invalid output was: Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1400951250.7-173380463612813/docker", line 1959, in <module>
    main()
  File "/root/.ansible/tmp/ansible-tmp-1400951250.7-173380463612813/docker", line 693, in main
    containers = manager.create_containers(1)
  File "/root/.ansible/tmp/ansible-tmp-1400951250.7-173380463612813/docker", line 548, in create_containers
    if docker.utils.compare_version('1.10', self.client.version()['ApiVersion']) < 0:
KeyError: 'ApiVersion'

Any ideas? Is there any combination of versions that works? I needed Ansible 1.7 because of the 'running' state that was added for docker containers.

ChocoDeveloper
  • 14,160
  • 26
  • 79
  • 117

3 Answers3

0

I ran into this issue today and decided to fix it. The gist of the problem is older versions of docker don't have an ApiVersion specified (that or the docker-py package doesn't return it).

I've submitted a pull request to fix this issue in the ansible docker module here: https://github.com/ansible/ansible/pull/7619

Alternatively you could upgrade your docker version to get around it.

justin
  • 453
  • 1
  • 4
  • 13
0

I got the same error and this fixed it

$ sudo apt-get install -y python-pip
$ sudo pip install docker-py
pau1_m
  • 11
  • 1
0

As said in a more general answer, use the docker_api_version: auto argument :

- name: Mongo data container
  docker:
    docker_api_version: auto
    name: mongo-primary-dc
    image: debian:wheezy
    state: present
    volumes:
    - /data
Community
  • 1
  • 1
Nicolas Zozol
  • 6,910
  • 3
  • 50
  • 74