From 5504f13c68f703fc4d67b1b1c5d3dfd58fe17cf2 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Sun, 25 Nov 2012 01:00:14 +0100 Subject: [PATCH] Create groups in the first run through the file Fixes #1208. --- lib/ansible/inventory/ini.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/inventory/ini.py b/lib/ansible/inventory/ini.py index fafe0b50237..ddf1ba95348 100644 --- a/lib/ansible/inventory/ini.py +++ b/lib/ansible/inventory/ini.py @@ -66,6 +66,8 @@ class InventoryParser(object): if line.startswith("["): active_group_name = line.replace("[","").replace("]","").strip() if line.find(":vars") != -1 or line.find(":children") != -1: + active_group_name = active_group_name.rsplit(":", 1)[0] + self.groups[active_group_name] = Group(name=active_group_name) active_group_name = None else: new_group = self.groups[active_group_name] = Group(name=active_group_name)