Issue 1:
ISSUE TYPE

Bug Report

COMPONENT NAME

docker_container

ANSIBLE VERSION

ansible --version
ansible 2.2.1.0
config file = /Users/alebedev/projects/ansible/ansible.cfg
configured module search path = Default w/o overrides

OS / ENVIRONMENT

N/A

SUMMARY

When you have a list of exposed ports and would like to publish only one of them

STEPS TO REPRODUCE

- name: Starting container
docker_container:
name: pool
image: pool
privileged: true
network_mode: bridge
exposed_ports:
- 8080:8080
- 5000-5040:5000-5040
published_ports:
- 8080:8080
detach: true
restart_policy: on-failure
interactive: true
state: started

EXPECTED RESULTS

TASK [pool : Starting container] *********************************************************

ok: [pool]

ACTUAL RESULTS

TASK [pool : Starting container] *************************
fatal: [pool]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_name": "docker_container"
},
"module_stderr": "OpenSSH_7.3p1, LibreSSL 2.4.1\r\ndebug1: Reading configuration data /Users/alebedev/.ssh/config\r\ndebug1: /Users/alebedev/.ssh/config line 1: Applying options for *\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 20: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 33458\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to 127.0.0.1 closed.\r\n",
"module_stdout": "\r\nTraceback (most recent call last):\r\n File \"/tmp/ansible_Bv3w6O/ansible_module_docker_container.py\", line 2007, in <module>\r\n main()\r\n File \"/tmp/ansible_Bv3w6O/ansible_module_docker_container.py\", line 2000, in main\r\n cm = ContainerManager(client)\r\n File \"/tmp/ansible_Bv3w6O/ansible_module_docker_container.py\", line 1644, in __init__\r\n self.parameters = TaskParameters(client)\r\n File \"/tmp/ansible_Bv3w6O/ansible_module_docker_container.py\", line 764, in __init__\r\n self.ports = self._parse_exposed_ports(self.published_ports)\r\n File \"/tmp/ansible_Bv3w6O/ansible_module_docker_container.py\", line 1039, in _parse_exposed_ports\r\n start_port, end_port = exposed_port[0].split('-')\r\nValueError: too many values to unpack\r\n"
}

MSG:

MODULE FAILURE

Issue 2:
Unlike ssh, which appears to have a connection timeout value which is wholly different from a task execution timeout, accelerate mode only appears to have one timeout.

This can create a very big problem, where one has to set the timeout very high to deal with long running processes, but then have to deal with very long timeouts on dark hosts.

It would be quite nice to duplicate what exists for ssh, where one can have a very short connection timeout (5 seconds) to give up on dark hosts, but a very long session timeout to handle long running tasks w/out resorting to a ton of async usage.

In our rather large environment we constantly have dark hosts, so this single timeout value will prevent us from going forward with accelerate mode.