added template method hostgroup logic