Am 08.06.2015 um 13:31 schrieb Shay Rojansky:
Hi everyone, I'm setting up a new icinga2 site and ran into a small difficulty.
The site in question already heavily uses ansible and it makes sense to
integrate icinga2 setup with it as much as possible. Specifically, ansible
roles should be translated into HostGroups etc.
The problem starts when multiple roles are assigned to the same Host - the host
definition now needs to be constructed across multiple ansible locations (each
one adding a group or attribute to the Host). While it is possible to define a
Service on a specific Host outside of the Host definition, that doesn't seem
possible with attributes or HostGroups (except for the case of assigning a
HostGroup to all hosts based on an attribute etc., but that doesn't seem
relevant here).
My current solution is to add an include *inside* the Host definition, and then
drop files adding attributes and group membership from the different roles.
This seems pretty heavy and needlessly complicated, though, am I missing
something?
Why don't you just assign hosts as members inside HostGroup definitions based
on patterns?
object HostGroup "windows" {
assign where match("win*", host.vars.os)
assign where regex("^win.*", host.name)
ignore where host.vars.internal
}
That way you don't need to modify the host object itself. You still could do
that by using object inheritance using templates though that might get utterly
complicated.
Kind regards,
Michael
Oh, and thanks for making an awesome monitoring platform!
Shay
_______________________________________________
icinga-users mailing list
[email protected]<mailto:[email protected]>
https://lists.icinga.org/mailman/listinfo/icinga-users
--
Michael Friedrich, DI (FH)
Application Developer
NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]
** OSBConf 2015 - September - osbconf.org **
** OSMC 2015 - November - netways.de/osmc **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users