From f04041b37dd13d31b0a8d690a1b66da8e9244ce7 Mon Sep 17 00:00:00 2001 From: Jeroen Hoekx Date: Sat, 14 Apr 2012 12:15:57 +0200 Subject: [PATCH] Ignore port numbers in simple inventory format --- lib/ansible/inventory.py | 3 +++ test/simple_hosts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory.py b/lib/ansible/inventory.py index 448ef372b0..429b4c95d9 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 14312af92d..6a4e297b4f 100644 --- a/test/simple_hosts +++ b/test/simple_hosts @@ -3,7 +3,7 @@ saturn [greek] zeus -hera +hera:3000 poseidon [norse]