Assigning hosts to hostgroup based on service state

Hello,

I want to create a hostgroup for hosts which I can schedule a downtime globally.
For example (or similar)

object HostGroup "Updates needed" {

  assign where regex("check_(apt|zypper)", service.name) and service_problem == 1
}

But I see that i can not use service.* vars inside an HostGroup object.
I would like to have a documentation what vars and objects can be used in assign rules.
Thanks in advance and kind regards

Ralf

Hi,

assign where expressions are evaluated statically during config compilation which happens during a restart/reload. There’s no possible chance that you incorporate runtime states in there.

HostGroup objects can only have Host objects as members. Your example uses services which doesn’t work. Access to the host object is granted, and every config attribute can be used, be it host.name or host.vars.some_custom_attribute.

Cheers,
Michael

Very big room for improvement here!