ansible/ansible — pull request #7714 by pmyjavec (2014-06-10 13:07:20+00:00)
Title: Docker links need alias specified

##### Issue Type:

“Bugfix Pull Request”

##### Ansible Version:
1.6.3

##### Environment:

RHEL 5/6, Centos 5/6, Mac OS X

##### Summary:

When specifying a link in the Docker module, according to the documentation, I should be able to specify the link with or without the alias, for example:

`link=container1:alias1` or `link=container`, the latter should just create the alias name for me. This has tripped up quite a few people.

##### Steps To Reproduce:

##### Expected Results:

```
PLAY [Deploy containers] *********************************************

GATHERING FACTS ***************************************************************
ok: [10.0.0.1]
ok: [10.0.0.2]

TASK: [start container] **********************************
changed: [10.0.0.1]
changed: [10.0.0.2]

PLAY RECAP ********************************************************************
10.0.0.1 : ok=3 changed=1 unreachable=0 failed=0
```

##### Actual Results:

```
TASK: [dns | start authoritative server] *********************************
failed: [10.0.0.1] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/var/tmp/ansible-tmp-1402405446.07-170195533473948/docker", line 1971, in
main()
File "/var/tmp/ansible-tmp-1402405446.07-170195533473948/docker", line 670, in main
manager = DockerManager(module)
File "/var/tmp/ansible-tmp-1402405446.07-170195533473948/docker", line 383, in __init__
self.links = dict(map(lambda x: x.split(':'), self.module.params.get('links')))
ValueError: dictionary update sequence element #0 has length 1; 2 is required

failed: [10.0.0.2] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/var/tmp/ansible-tmp-1402405446.07-25177571174266/docker", line 1971, in
main()
File "/var/tmp/ansible-tmp-1402405446.07-25177571174266/docker", line 670, in main
manager = DockerManager(module)
File "/var/tmp/ansible-tmp-1402405446.07-25177571174266/docker", line 383, in __init__
self.links = dict(map(lambda x: x.split(':'), self.module.params.get('links')))
ValueError: dictionary update sequence element #0 has length 1; 2 is required

FATAL: all hosts have already failed -- aborting
```