func (inv *InventoryList) GetHostsForGroup(group string) []string {
	hosts := []string{}
	for k, hg := range *inv {
		if k == group {
			if len(hg.Children) > 0 {
				for _, child := range hg.Children {
					hosts = append(hosts, inv.GetHostsForGroup(child)...)
				}
			}
			if len(hg.Hosts) > 0 {
				hosts = append(hosts, hg.Hosts...)
			}
		}
	}
	return hosts
}
GetHostsForGroup return resolved list of hosts for a given group name
package ansible
import (
	"encoding/json"
)
type InventoryList map[string]HostGroup
type HostGroup struct {
	Children []string `json:"children"`
	Hosts    []string `json:"hosts"`
}
func Parse(in []byte) (*InventoryList, error) {
	inv := &InventoryList{}
	if err := json.Unmarshal(in, inv); err != nil {
		return nil, err
	}
	return inv, nil
}