I would like to define service groups, per host, with always the same services and would like to maintain the services redundantly, since the templates only support properties and are not there for the inheritance of assignments, I wanted to help myself with a function, but here I get the error
My function is referenced here =>
“critical/config: Error: Argument is not a callable object.”
Example configuration:
##############################################
function service_matches(host, service) {
return regex(“^Live$”, host.vars.roles, MatchAny) && (match(“*CustomService*”, service.name))
}
object ServiceGroup “Test” {
display_name = “TestSG”
assign where host.name in [“aaa.test.de”, “bbb.test.de”] && service_matches(host, service)
}
thanks for your answer, the problem is that there are several services and I would not like to redefine them again and again, but only want to define the target hosts per service group and load the services additionally using a function
thanks for providing the documentation, we don’t use the director and write the rules ourselves, it’s okay if that doesn’t work, the idea was to save the countless redundant service definitions, just define them once and then only create specific ServiceGroups per host, we’re talking about over 50 services, that otherwise fills the config, but if that’s the way to go, we’ll do it that way, thanks!
I just wanted to stick to the dont repeat your self method here and that’s what I have to do.
We do not have the case that we are interested in all hosts per ServiceGroup, but the ServiceGroup must be grouped per host, so it only works for us.
thanks for the tip with globals now it is so that it is basically seen by the config as okay, but I can not find the ServiceGroup objects, where is the error?