Issue 1:
ISSUE TYPE

Bug

COMPONENT NAME

docker_service_module

ANSIBLE VERSION

ansible 2.2.1.0

OS / ENVIRONMENT

ubntu 16.04 LTS

SUMMARY

Whene I try to use docker_service module I get an error about docker-compose.

In my machine I've install docker, docker-compose and docker has port 4243 enabled for API

---
- hosts: all
user: root
vars:
username: claudio
password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
public_key: ~/.ssh/id_rsa.pub
tasks:
- name: cloning repo
become: yes
become_user: manager
git:
repo=git@bitbucket.org:xxxxx/xxxxxxxxxxx.git
dest=/home/manager/project
accept_hostkey=yes
version=master
force=yes
recursive=no
key_file=/home/manager/.ssh/id_rsa
- hosts: local
user: root
vars:
username: claudio
password: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
public_key: ~/.ssh/id_rsa.pub
tasks:
- name: docker system
become: yes
become_user: manager
docker_service:
project_src: /home/manager/project/conf_default
state: present

ACTUAL RESULTS

Using /home/manager/project/ansible/ansible.cfg as config file

PLAY [all] *********************************************************************

TASK [setup] *******************************************************************
ok: [xxx.xxx.xxx.xxx]
ok: [xxx.xxx.xxx.xxx]

TASK [cloning repo] ************************************************************
ok: [xxx.xxx.xxx.xxx] => {"after": "4ff912eaf4a81f83ebf19ef5e871ac15c9ff9177", "before": "4ff912eaf4a81f83ebf19ef5e871ac15c9ff9177", "changed": false, "warnings": []}
ok: [xxx.xxx.xxx.xxx] => {"after": "4ff912eaf4a81f83ebf19ef5e871ac15c9ff9177", "before": "4ff912eaf4a81f83ebf19ef5e871ac15c9ff9177", "changed": false, "warnings": []}

PLAY [local] *******************************************************************

TASK [setup] *******************************************************************
ok: [xxx.xxx.xxx.xxx]

TASK [docker system] ***********************************************************
fatal: [xxx.xxx.xxx.xxx]: FAILED! => {"changed": false, "failed": true, "msg": "Unable to load docker-compose. Try `pip install docker-compose`. Error: cannot import name IPAMConfig"}
to retry, use: --limit @/home/manager/control-methods/ansible/provision.retry

PLAY RECAP *********************************************************************
xxx.xxx.xxx.xxx : ok=2 changed=0 unreachable=0 failed=0
xxx.xxx.xxx.xxx : ok=3 changed=0 unreachable=0 failed=1

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

docker_container

ANSIBLE VERSION

ansible 2.3.0 (devel 216e2c8813) last updated 2017/01/20 09:22:29 (GMT +000)
ansible 2.2.0.0 (detached HEAD cdec853e37) last updated 2017/01/20 09:25:31 (GMT +000)

CONFIGURATION

Nothing changed

OS / ENVIRONMENT

Linux machine1 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux

pip list:

pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
backports.ssl-match-hostname (3.5.0.1)
cached-property (1.3.0)
chardet (2.3.0)
colorama (0.3.7)
defusedxml (0.4.1)
docker (2.0.2)
docker-compose (1.10.0)
docker-py (1.10.6)
docker-pycreds (0.2.1)
dockerpty (0.4.1)
docopt (0.6.2)
docutils (0.12)
enum34 (1.1.6)
functools32 (3.2.3.post2)
iotop (0.6)
ipaddress (1.0.18)
jsonschema (2.5.1)
Pillow (2.6.1)
pip (9.0.1)
Pygments (2.0.1)
python-apt (0.9.3.12)
python-debian (0.1.27)
python-debianbts (1.11)
PyYAML (3.12)
reportbug (6.6.3)
requests (2.11.1)
roman (2.0.0)
setuptools (5.5.1)
six (1.10.0)
SOAPpy (0.12.22)
texttable (0.8.7)
websocket-client (0.40.0)
wstools (0.4.3)

python --version

Python 2.7.9

docker info

Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 1.12.3
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 0
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge null overlay host
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options:
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.963 GiB
Name: machine1
ID: PD6F:VQDI:VAK4:O3YU:PWDT:HFAG:T3Z4:FNP5:QLT7:C3TO:7OKS:OODH
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Insecure Registries:
127.0.0.0/8

SUMMARY

When module docker_container is used, it fails every time with

"Failed to import docker-py - cannot import name Client. Try `pip install docker-py`"

STEPS TO REPRODUCE

- docker_container:
image: hello-world
name: hello

EXPECTED RESULTS

Image is executed.

ACTUAL RESULTS

TASK [docker-registry : docker_container] **************************************
task path: /vagrant/service-playbooks/roles/docker-registry/tasks/registry-server.yml:56
Using module file /home/vagrant/ansible/lib/ansible/modules/core/cloud/docker/docker_container.py
<192.168.77.201> ESTABLISH SSH CONNECTION FOR USER: deploy
<192.168.77.201> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817 `" && echo ansible-tmp-1484904632.51-163570270155817="` echo $HOME/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817 `" ) && sleep 0'"'"''
<192.168.77.201> PUT /tmp/tmpeXfDvf TO /home/deploy/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817/docker_container.py
<192.168.77.201> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.77.201]'
<192.168.77.201> ESTABLISH SSH CONNECTION FOR USER: deploy
<192.168.77.201> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r 192.168.77.201 '/bin/sh -c '"'"'chmod u+x /home/deploy/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817/ /home/deploy/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817/docker_container.py && sleep 0'"'"''
<192.168.77.201> ESTABLISH SSH CONNECTION FOR USER: deploy
<192.168.77.201> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=deploy -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.77.201 '/bin/sh -c '"'"'/usr/bin/python /home/deploy/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817/docker_container.py; rm -rf "/home/deploy/.ansible/tmp/ansible-tmp-1484904632.51-163570270155817/" > /dev/null 2>&1 && sleep 0'"'"''
fatal: [machine_1]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"api_version": null,
"blkio_weight": null,
"cacert_path": null,
"capabilities": null,
"cert_path": null,
"cleanup": false,
"command": null,
"cpu_period": null,
"cpu_quota": null,
"cpu_shares": null,
"cpuset_cpus": null,
"cpuset_mems": null,
"debug": false,
"detach": true,
"devices": null,
"dns_opts": null,
"dns_search_domains": null,
"dns_servers": null,
"docker_host": null,
"entrypoint": null,
"env": null,
"env_file": null,
"etc_hosts": null,
"exposed_ports": null,
"filter_logger": false,
"force_kill": false,
"groups": null,
"hostname": null,
"ignore_image": false,
"image": "hello-world",
"interactive": false,
"ipc_mode": null,
"keep_volumes": true,
"kernel_memory": null,
"key_path": null,
"kill_signal": null,
"labels": null,
"links": null,
"log_driver": null,
"log_options": null,
"mac_address": null,
"memory": "0",
"memory_reservation": null,
"memory_swap": null,
"memory_swappiness": null,
"name": "hello",
"network_mode": null,
"networks": null,
"oom_killer": null,
"oom_score_adj": null,
"paused": false,
"pid_mode": null,
"privileged": false,
"published_ports": null,
"pull": false,
"purge_networks": false,
"read_only": false,
"recreate": false,
"restart": false,
"restart_policy": null,
"restart_retries": null,
"security_opts": null,
"shm_size": null,
"ssl_version": null,
"state": "started",
"stop_signal": null,
"stop_timeout": null,
"timeout": null,
"tls": null,
"tls_hostname": null,
"tls_verify": null,
"trust_image_content": false,
"tty": false,
"ulimits": null,
"user": null,
"uts": null,
"volume_driver": null,
"volumes": null,
"volumes_from": null
},
"module_name": "docker_container"
},
"msg": "Failed to import docker-py - cannot import name Client. Try `pip install docker-py`"
}
to retry, use: --limit @/vagrant/service-playbooks/microservice-infrastructure-no-elastic.retry