diff --git a/aini_test.go b/aini_test.go index 5b50898..1d1ccd7 100644 --- a/aini_test.go +++ b/aini_test.go @@ -124,6 +124,8 @@ func TestBelongToBasicGroups(t *testing.T) { func TestGroupStructure(t *testing.T) { v := parseString(t, ` + host5 + [web:children] nginx apache diff --git a/parser.go b/parser.go index 432c7cf..bd3c30d 100644 --- a/parser.go +++ b/parser.go @@ -72,6 +72,9 @@ func (inventory *InventoryData) parse(reader *bufio.Reader) error { } for k, v := range hosts { activeGroup.Hosts[k] = v + if activeGroup.Name != "ungrouped" { + delete(inventory.Groups["ungrouped"].Hosts, k) + } } for _, host := range hosts { inventory.Hosts[host.Name] = host