diff --git a/lib/ansible/inventory.py b/lib/ansible/inventory.py index 448ef372b04..429b4c95d9f 100644 --- a/lib/ansible/inventory.py +++ b/lib/ansible/inventory.py @@ -105,6 +105,9 @@ class Inventory(object): groups[group_name] = [] elif item != "": # looks like a regular host + if ":" in item: + # a port was specified + item, port = item.split(":") groups[group_name].append(item) if not item in results: results.append(item) diff --git a/test/simple_hosts b/test/simple_hosts index 14312af92d8..6a4e297b4fb 100644 --- a/test/simple_hosts +++ b/test/simple_hosts @@ -3,7 +3,7 @@ saturn [greek] zeus -hera +hera:3000 poseidon [norse]