ansible-nagios-config
ansible-nagios-config copied to clipboard
Invert Host and HostGroup dependencies. Have host declare group memberships.
Currently we declare a hostgroup with the members.
This makes the members line churn as any server added or removed will alter these lines. Obviously, there are worse things in the world. This is automated so people shouldn't have to look at this, but there will always be the times when a person needs to look at this.
One solution is to have hosts declare their group membership.
define hostgroup {
hostgroup_name all-prod
}
define hostgroup {
hostgroup_name web-app-prod
}
define host {
host_name production-web-app-1
notes i-deadbeef
use generic-remote-host
address 127.0.0.1
hostgroups all-prod,web-app-prod
}
If we use the above approach, adding and removing hosts generate clean diffs.
Note: we can use the same approach with service
s and servicegroup
s