I am running into this issue also
On max OSX with
ansible 1.9.2
docker-py
I have upgraded both with:
pip install docker-py --upgrade
brew install ansible --upgrade
The playbook has:
- hosts: testgroup
# remote_user: ubuntu
tasks:
- name: start container
docker:
name: redacted
image: redacted/container_redacted
state: started
And I get:
TASK: [start redactewd container_redacted]
***********************************************
failed: [server22] => {"failed": true, "parsed": false}
BECOME-SUCCESS-gfuvfqhggbuflektwrxxarzyhxlmfuba
Traceback (most recent call last):
File
"/home/user/.ansible/tmp/ansible-tmp-1437672252.13-215965289016980/docker",
line 3132, in <module>
main()
File
"/home/user/.ansible/tmp/ansible-tmp-1437672252.13-215965289016980/docker",
line 1436, in main
docker_api_version = dict(required=False,
default=DEFAULT_DOCKER_API_VERSION, type='str'),
NameError: global name 'DEFAULT_DOCKER_API_VERSION' is not defined
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/nerdenq/.ssh/config
debug1: /Users/user/.ssh/config line 3: Applying options for *
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: auto-mux: Trying existing master
debug1: mux_client_request_session: master session id: 2
Shared connection to server22 closed.
FATAL: all hosts have already failed -- aborting
Isn't it normally fixed?
https://github.com/ansible/ansible-modules-core/issues/683
On Wednesday, February 18, 2015 at 3:13:35 PM UTC+1, Matt Martz wrote:
>
> I believe what you wanted to do with the pip module is actually provide
> state=latest. Omitting state just means state=present which satisfies pip
> if any current version is installed.
>
> latest invokes pip with -U which is an alias for --upgrade
>
> On Tuesday, February 17, 2015, Jilles van Gurp <[email protected]
> <javascript:>> wrote:
>
>> I just ran into an obscure issue where I actually had a version of
>> docker-py installed on a target system but not the latest version. Long
>> version below but the tldr; is that I eventually solved it with a manual
>> pip install --upgrade.
>>
>> I was looking at the pip module documentation and there's nothing about
>> --upgrade there. I guess I could pass it in via extra_args="--upgrade" but
>> this sounds like it deserves a bit more prominent mention. Also it sounds
>> like it might actually be a useful default even if the user specifies no
>> version (latest is implied) and the installed version is outdated. Either
>> that or it should fail because it can't get the latest version installed
>> unless you specify --upgrade.
>>
>> Long version:
>>
>> So, I was getting the error that
>>
>> Traceback (most recent call last):
>> File
>> "/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
>> line 2422, in <module>
>> main()
>> File
>> "/home/linko/.ansible/tmp/ansible-tmp-1424196296.48-135783178760818/docker",
>> line 729, in main
>> docker_api_version =
>> dict(default=docker.client.DEFAULT_DOCKER_API_VERSION),
>> NameError: global name 'docker' is not defined
>>
>> When trying to run my ansible playbook that first installs docker and
>> then boots up a docker image. Basically it looked like I didn't have
>> docker-py installed; except I had.
>>
>> Actually I was installing it via a docker role:
>>
>> ---
>> - name: Install Python Pip
>> yum: name=python-pip state=latest
>>
>> - name: ensure docker is installed
>> yum: name=docker state=latest
>>
>> - name: Install Docker-py
>> pip: name=docker-py
>>
>> - name: Start docker daemon
>> service: name=docker state=started enabled=yes sleep=1
>>
>>
>> The problem as it turned out to be, was that pip was basically
>> 'succeeding' with the following message:
>>
>> ok: [testing.inbot.io] => {"changed": false, "cmd": "/bin/pip install
>> docker-py", "name": "docker-py", "requirements": null, "state": "present",
>> "stderr": "", "stdout": "Requirement already satisfied (use --upgrade to
>> upgrade): docker-py in /usr/lib/python2.7/site-packages\nRequirement
>> already satisfied (use --upgrade to upgrade): requests>=2.2.1,<2.5.0 in
>> /usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
>> satisfied (use --upgrade to upgrade): six>=1.3.0 in
>> /usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
>> satisfied (use --upgrade to upgrade): websocket-client>=0.11.0 in
>> /usr/lib/python2.7/site-packages (from docker-py)\nRequirement already
>> satisfied (use --upgrade to upgrade): backports.ssl-match-hostname in
>> /usr/lib/python2.7/site-packages (from
>> websocket-client>=0.11.0->docker-py)\nCleaning up...\n", "version": null,
>> "virtualenv": null}
>>
>> Solution:
>>
>> sudo pip install docker-py --upgrade
>>
>> After that everything works as it is supposed to.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ansible Project" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/fd9826b2-2520-433a-a48a-f5f39ef8af9c%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/fd9826b2-2520-433a-a48a-f5f39ef8af9c%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> Matt Martz
> @sivel
> sivel.net
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/542d194a-92a3-41a8-9a7e-aad43811ae83%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.