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

port_published fails when uses a port range as an argument

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
- 5000-5040:5000-5040
detach: true
restart_policy: on-failure
interactive: true
state: started

EXPECTED RESULTS

Expecting that container will be up and running with a published port range accordingly to official documentation from docker:

https://docs.docker.com/engine/reference/run/#/expose-incoming-ports

ACTUAL RESULTS

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 = 33959\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_oqSXjO/ansible_module_docker_container.py\", line 2007, in <module>\r\n main()\r\n File \"/tmp/ansible_oqSXjO/ansible_module_docker_container.py\", line 2000, in main\r\n cm = ContainerManager(client)\r\n File \"/tmp/ansible_oqSXjO/ansible_module_docker_container.py\", line 1644, in __init__\r\n self.parameters = TaskParameters(client)\r\n File \"/tmp/ansible_oqSXjO/ansible_module_docker_container.py\", line 759, in __init__\r\n self.published_ports = self._parse_publish_ports()\r\n File \"/tmp/ansible_oqSXjO/ansible_module_docker_container.py\", line 968, in _parse_publish_ports\r\n container_port = int(parts[-1])\r\nValueError: invalid literal for int() with base 10: '5000-5040'\r\n"
}

MSG:

MODULE FAILURE

Issue 2:
Issue Type:

Feature Idea

Ansible Version:

2.0.0.1

Summary:

This isn't an issue for sure, maybe a feature idea. I want to lint a playbook to detect following few among many other possibilities:

Undefined variable

Unused variable

See if vars defined, when case-ignored, are same( conflicting vars hereafter)

I'm not able to figure out what is the good way to do this? I don't want to re-invent the wheel, in the sense that:

I don't want to do text processing. Ansible does this to accomplish its task.

Hooks or callbacks if I'm not wrong are couple of levels higher than where I think my solution should hop in.

My intention is to write a tool that seamlessly, and optionally, works with ansible. I would like not to modify ansible's code if I can do without.

Any help or hack or suggestion is appreciated. TIA.