# Adding host groups when using templates

**URL:** <https://community.icinga.com/t/adding-host-groups-when-using-templates/8193>\
**Category:** Icinga Director\
**Tags:** host-groups\
**Created:** [September 10, 2021, 6:49am UTC](https://community.icinga.com/t/adding-host-groups-when-using-templates/8193 "2021-09-10T06:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fireba11](https://community.icinga.com/letter_avatar_proxy/v4/letter/f/7ab992/32.png) [@fireba11](https://community.icinga.com/u/fireba11)\
**Post date:** [September 10, 2021, 6:49am UTC](https://community.icinga.com/t/adding-host-groups-when-using-templates/8193/1 "2021-09-10T06:49:14Z")

</div>

I’m trying to have host templates that already come with host groups (things like linux, agent) but then add more groups to the host based on that template (server location etc.) all host groups from the template get replaced. Is there a way to just add to the host groups already there from the template?

---

<div class="post-metadata">

**Author:** ![log1c](https://community.icinga.com/user_avatar/community.icinga.com/log1c/32/2071_2.png) [@log1c](https://community.icinga.com/u/log1c)\
**Post date:** [September 10, 2021, 8:53am UTC](https://community.icinga.com/t/adding-host-groups-when-using-templates/8193/2 "2021-09-10T08:53:35Z")

</div>

This is a quite long lasting bug/feature request:

> <https://github.com/Icinga/icingaweb2-module-director/issues/344>
>
> This issue has been migrated from Redmine: https://dev.icinga.com/issues/12122
> 
> …\*\*Created by spillerm on 2016-07-07 07:41:39 +00:00\*\*
> 
> Assignee: \_(none)\_
> Status: \_New\_ 
> Target Version: \_(none)\_
> Last Update: \_2016-12-06 23:51:05 +00:00 (in Redmine)\_
> 
> \---
> 
> Hi,
> 
> I noticed the following: in Director, I created a host template "generic-cisco", preview of this template is:
> 
> @
> template Host "generic-cisco" {
> import "generic-switch-template"
> 
> groups = \\\["corporate", "network" \\\]
> vars.is\\\_cisco = "true"
> }
> @
> 
> Now I would like to add a switch, so I create an object which imports generic-cisco; the field "groups" remains empty, and even when I'm looking at the "resolved" preview, my group assignment does not appear.
> So at this point, inheritance does not seem to work.
> 
> Regards,
> Marianne
> 
> \---
> 
> \*\*Relations\*\*:
> 
> \* relates \[#13375\](https://dev.icinga.com/issues/13375)

For now you will have to add all the groups manually.  
Or you use the assign where statements at the host groups side, if that is possible for you.
