# HostGroup defined in a child zone gets applied to hosts in a different zone

**URL:** <https://community.icinga.com/t/hostgroup-defined-in-a-child-zone-gets-applied-to-hosts-in-a-different-zone/13069>\
**Category:** Icinga 2\
**Created:** [December 21, 2023, 10:16am UTC](https://community.icinga.com/t/hostgroup-defined-in-a-child-zone-gets-applied-to-hosts-in-a-different-zone/13069 "2023-12-21T10:16:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mj84](https://community.icinga.com/user_avatar/community.icinga.com/mj84/32/2116_2.png) [@mj84](https://community.icinga.com/u/mj84)\
**Post date:** [December 21, 2023, 10:16am UTC](https://community.icinga.com/t/hostgroup-defined-in-a-child-zone-gets-applied-to-hosts-in-a-different-zone/13069/1 "2023-12-21T10:16:29Z")

</div>

Hello folks,

I am observing an unsual behaviour while assigning HostGroups using apply rules.

I have a simple parent-child layout for my endpoints and zones:

- One parent zone
- One global zone for templates and such
- Several child zones containing host objects

I have now begun defining HostGroups in the child zones.

My assign rules for these HostGroups are rather generic, e.g.:  
`assign where "notify-mail" in host.vars.tags`, so there are definitely cases, where hosts from other zones also match that criteria.

I’d have expected that these groups would only match in their respective zone (since they are defined in that very zone), but it seems that they match _globally_ for _any_ host in _any_ zone which fulfills the specified condition(s).

Can somebody confirm this behaviour? Is this intended behaviour?

I’m running Icinga r2.14.0-1 on CentOS 7.

Best regards,  
Markus

---

<div class="post-metadata">

**Author:** ![mj84](https://community.icinga.com/user_avatar/community.icinga.com/mj84/32/2116_2.png) [@mj84](https://community.icinga.com/u/mj84)\
**Post date:** [December 21, 2023, 10:38am UTC](https://community.icinga.com/t/hostgroup-defined-in-a-child-zone-gets-applied-to-hosts-in-a-different-zone/13069/2 "2023-12-21T10:38:40Z")

</div>

My current workaround is to use something like `assign where host.zone == "child-zone1" && "notify-mail" in host.vars.tags` but I find this approach unnecessarily clunky
