<h5 dir="auto">Issue Type: Bug Report</h5>
<h5 dir="auto">Ansible Version:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 1.9.0.1
  configured module search path = None"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 1.9.0.1
  configured module search path = None
</code></pre></div>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Running on Mac OS to manage an Ubuntu 14.04 VM.</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">The new version 1.2.1 of the "docker-py" module seems to have removed the "docker.client.DEFAULT_DOCKER_API_VERSION" variable that Ansible was using.</p>
<p dir="auto">FWIW - It looks like this 1.2.1 release of "docker-py" just came out today, 4/29/15. See: <a href="https://pypi.python.org/pypi/docker-py" rel="nofollow">https://pypi.python.org/pypi/docker-py</a>.</p>
<p dir="auto">And here's a link to the diff on "docker-py" where <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/shin-/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/shin-">@shin-</a> removed "docker.client.DEFAULT_DOCKER_API_VERSION":<br>
<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/docker/docker-py/commit/ae329cb3acb3ff38bd986215c99b1136a6183f78/hovercard" href="https://github.com/docker/docker-py/commit/ae329cb3acb3ff38bd986215c99b1136a6183f78">docker/docker-py@<tt>ae329cb</tt></a></p>
<p dir="auto">And the new "docker.constants" file where this variable was moved to:<br>
<a href="https://github.com/docker/docker-py/blob/ae329cb3acb3ff38bd986215c99b1136a6183f78/docker/constants.py#L1">https://github.com/docker/docker-py/blob/ae329cb3acb3ff38bd986215c99b1136a6183f78/docker/constants.py#L1</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK: [apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container] *****
failed: [default] =&gt; {&quot;failed&quot;: true, &quot;parsed&quot;: false}
BECOME-SUCCESS-ldprfowyxhdsqcsgmtrqpvirszzgajwq
Traceback (most recent call last):
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 3104, in &lt;module&gt;
    main()
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 1449, in main
    manager = DockerManager(module)
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 558, in __init__
    docker_api_version=docker.client.DEFAULT_DOCKER_API_VERSION
AttributeError: 'module' object has no attribute 'DEFAULT_DOCKER_API_VERSION'"><pre class="notranslate"><code class="notranslate">TASK: [apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container] *****
failed: [default] =&gt; {"failed": true, "parsed": false}
BECOME-SUCCESS-ldprfowyxhdsqcsgmtrqpvirszzgajwq
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 3104, in &lt;module&gt;
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 1449, in main
    manager = DockerManager(module)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 558, in __init__
    docker_api_version=docker.client.DEFAULT_DOCKER_API_VERSION
AttributeError: 'module' object has no attribute 'DEFAULT_DOCKER_API_VERSION'
</code></pre></div>
<p dir="auto">If I downgrade my "docker-py" to the previous 1.1.0 release, the Ansible operation completes successfully.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">Pretty basic use of Ansible's "docker" module:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name: apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container
  docker:
    image=extellisys/apt-cacher-ng
    name=apt-cacher-ng
    ports=&quot;{{ apt_cache_server_port }}:3142&quot;
    volumes=&quot;{{ apt_cache_server_dir }}:/var/cache/apt-cacher-ng&quot;"><pre class="notranslate"><code class="notranslate">- name: apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container
  docker:
    image=extellisys/apt-cacher-ng
    name=apt-cacher-ng
    ports="{{ apt_cache_server_port }}:3142"
    volumes="{{ apt_cache_server_dir }}:/var/cache/apt-cacher-ng"
</code></pre></div>
<p dir="auto">Again, this issue occurs when "docker-py" is 1.2.1 and not when "docker-py" is 1.1.0.</p>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">I expect Ansible's "docker" module to work correctly.</p>
<h5 dir="auto">Actual Results:</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK: [apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container] *****
failed: [default] =&gt; {&quot;failed&quot;: true, &quot;parsed&quot;: false}
BECOME-SUCCESS-ldprfowyxhdsqcsgmtrqpvirszzgajwq
Traceback (most recent call last):
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 3104, in &lt;module&gt;
    main()
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 1449, in main
    manager = DockerManager(module)
  File &quot;/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker&quot;, line 558, in __init__
    docker_api_version=docker.client.DEFAULT_DOCKER_API_VERSION
AttributeError: 'module' object has no attribute 'DEFAULT_DOCKER_API_VERSION'"><pre class="notranslate"><code class="notranslate">TASK: [apt-cacher-ng | Run the extellisys/apt-cacher-ng Docker container] *****
failed: [default] =&gt; {"failed": true, "parsed": false}
BECOME-SUCCESS-ldprfowyxhdsqcsgmtrqpvirszzgajwq
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 3104, in &lt;module&gt;
    main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 1449, in main
    manager = DockerManager(module)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1430328017.67-135370415083178/docker", line 558, in __init__
    docker_api_version=docker.client.DEFAULT_DOCKER_API_VERSION
AttributeError: 'module' object has no attribute 'DEFAULT_DOCKER_API_VERSION'
</code></pre></div>
<p dir="auto">docker-py recently moved their constants in a backwards incompatible way in v1.2.x</p>
<p dir="auto">Previously we accessed <code class="notranslate">docker.client.DEFAULT_DOCKER_API_VERSION</code></p>
<p dir="auto">That constant is now available at <code class="notranslate">docker.client.constants.DEFAULT_DOCKER_API_VERSION</code></p>
<p dir="auto">See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="71432030" data-permission-text="Title is private" data-url="https://github.com/docker/docker-py/issues/570" data-hovercard-type="pull_request" data-hovercard-url="/docker/docker-py/pull/570/hovercard" href="https://github.com/docker/docker-py/pull/570">docker/docker-py#570</a> for the relevant change.</p>
<p dir="auto">We will need to update reference of this constant.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/smashwilson/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/smashwilson">@smashwilson</a> <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/abadger/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/abadger">@abadger</a></p>