Victor Bocharsky
Victor Bocharsky

Reputation: 12306

msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

I get an error on TASK: nginx container:

failed: [localhost] => {"changed": false, "failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

FATAL: all hosts have already failed -- aborting

When play next Ansible playbook:

---
-   name: Play
    hosts: localhost
    vars: []
    tasks:
        -   name: nginx container
            docker:
                name: my.nginx2
                image: nginx
                state: started

What I do wrong? Is this a bug?

P.S. More verbose output got with -vvvv is:

<localhost> REMOTE_MODULE docker state=started name=my.nginx2 image=nginx
<localhost> EXEC ['/bin/sh', '-c', 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561 && echo $HOME/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561']
<localhost> PUT /tmp/tmp7ySlXq TO /home/victor/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561/docker
<localhost> EXEC ['/bin/sh', '-c', u'LANG=C LC_CTYPE=C /usr/bin/python /home/victor/.ansible/tmp/ansible-tmp-1431434101.65-11072088770561/docker']
failed: [localhost] => {"changed": false, "failed": true}
msg: ConnectionError(ProtocolError('Connection aborted.', error(2, 'No such file or directory')),)

FATAL: all hosts have already failed -- aborting

Upvotes: 4

Views: 3038

Answers (1)

Valeriy Solovyov
Valeriy Solovyov

Reputation: 5648

You should install docker:

- name: install docker
  shell: curl -sSL https://get.docker.com/ | sh
  args:
     creates: /usr/bin/docker

And you should check that it works:

- name: Wait for the Docker server to start
  action: raw docker version
  register: docker_version
  until: docker_version.stdout.find("Client") != -1
  retries: 30
  delay: 10

And you need met all dependencies(http://docs.ansible.com/ansible/docker_module.html):

Requirements (on host that executes module)
python >= 2.6
docker-py >= 0.3.0
The docker server >= 0.10.0

Upvotes: 2

Related Questions