Hi all,
I have a bunch of server with the same checks, which are all configured with a host template and dictionaries, e.g.
apply Service "by_ssh: " for ( by_ssh => config in host.vars.by_ssh) {
import "by_ssh"
vars += config
assign where host.vars.by_ssh
}
template Host "bla" {
....
vars.by_ssh["Service a"] = {
by_ssh_command = "a"
}
vars.by_ssh["Service b"] = {
by_ssh_command = "b"
}
vars.by_ssh["Service c"] = {
by_ssh_command = "c"
}
vars.by_ssh["Service d"] = {
by_ssh_command = "d"
}
and so on....
}
On 99.9% of the server, which have this template imported, it fits. But on one or two server, I have to delete specific dictionaries, e.g. “Service d”.
So I would like to delete it in the host configuration instead of not importing the template and add the whole config to the host.
I know, there is a vars.remove("x")
function. But I could not find a way to delete the specific Service dictionary.
With vars.remove("by_ssh")
I just delete all “by_ssh” Services, but things like vars.remove("by_ssh["Service d"]")
dĂd not work.
How do I have to remove it (there is a space in the Service name) ?
Cheers and thanks,
Marcus