Hi is there a way of making a function or define a variable. Below is an example:
apply Dependency "dep-Abbey" to Host { parent_host_name = "abbey-router" disable_checks = true disable_notifications = true if (get_host(parent_host_name).vars.childs == null) { get_host(parent_host_name).vars.childs = [] # Define parent-host custom-variable "childs" } get_host(parent_host_name).vars.childs.add(host.name) # Add child-host in parent-host custom-variable "childs" if (get_host(host.name).vars.parent == null) { get_host(host.name).vars.parent = [] # Define parent-host custom-variable "childs" } get_host(host.name).vars.parent.add(parent_host_name) assign where host.vars.domain_name == "abbey-group.local" }
Can I create a reusable function for:
disable_checks = true
disable_notifications = trueif (get_host(parent_host_name).vars.childs == null) {
get_host(parent_host_name).vars.childs = [] # Define parent-host custom-variable “childs”
}
get_host(parent_host_name).vars.childs.add(host.name) # Add child-host in parent-host custom-variable “childs”if (get_host(host.name).vars.parent == null) {
get_host(host.name).vars.parent = [] # Define parent-host custom-variable “childs”
}get_host(host.name).vars.parent.add(parent_host_name)