blob: 498552b57b8f17236a3f246b4614aec5cf6acfd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
define site_nagios::add_host {
$nagios_host = $name
$nagios_hostname = $name['domain_internal']
$nagios_ip = $name['ip_address']
$nagios_services = $name['services']
$nagios_openvpn_gw = $name['openvpn_gateway_address']
# Add Nagios host
nagios_host { $nagios_hostname:
address => $nagios_ip,
use => 'generic-host',
}
# Add Nagios service
# First, we need to turn the serice array into hash, using a "hash template"
# see https://github.com/ashak/puppet-resource-looping
$nagios_service_hashpart = {
'hostname' => $nagios_hostname,
'ip_address' => $nagios_ip,
'openvpn_gw' => $nagios_openvpn_gw,
}
$dynamic_parameters = {
'service' => '%s'
}
$nagios_servicename = "${nagios_hostname}_%s"
$nagios_service_hash = create_resources_hash_from($nagios_servicename, $nagios_services, $nagios_service_hashpart, $dynamic_parameters)
create_resources ( site_nagios::add_service, $nagios_service_hash )
}
|