Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/nagios/manifests/server.pp

Issue 4810150141493248: Issue 122 - Puppet ENC via Hiera (Closed)
Patch Set: Puppet ENC via Hiera Created March 4, 2015, 5:59 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/nagios/manifests/server.pp
===================================================================
--- a/modules/nagios/manifests/server.pp
+++ b/modules/nagios/manifests/server.pp
@@ -4,7 +4,8 @@
$private_key,
$is_default=false,
$htpasswd_source,
- $admins
+ $admins,
+ $zone,
) {
File {
@@ -121,10 +122,9 @@
Nagios_host <| |> {
target => '/etc/nagios3/conf.d/hosts.cfg',
- require => Package['nagios3'],
notify => [File['/etc/nagios3/conf.d/hosts.cfg'], Service['nagios3']]
}
-
+ <-
Nagios_hostgroup <| |> {
target => '/etc/nagios3/conf.d/hostgroups.cfg',
require => Package['nagios3'],
@@ -146,4 +146,41 @@
require => Package['nagios3'],
notify => Service['nagios3']
}
+
+ $nagios_contacts = hiera('nagios_contacts', {})
+ create_resources(nagios_contact, $nagios_contacts)
+
+ $nagios_contactgroups = hiera('nagios_contactgroups', {})
+ create_resources(nagios_contactgroup, $nagios_contactgroups)
+
+ $nagios_commands = hiera('nagios_commands', {})
+ create_resources(nagios_command, $nagios_commands)
+
+ $nagios_services = hiera('nagios_services', {})
+ create_resources(nagios_service, $nagios_services)
+
+ $nagios_hosts = hiera('nagios_hosts', {})
+ create_resources(nagios_host, $nagios_hosts)
+
+ $nagios_hostgroups = hiera('nagios_hostgroups', {})
+ create_resources(nagios_hostgroup, $nagios_hostgroups)
+
+ $nagios_generic = hiera('servers')
+ create_resources(nagios::server::generic_host, $nagios_generic)
+
+ define generic_host(
+ $ip,
+ $ssh_public_key = undef,
+ $role = undef,
+ $dns = undef,
+ $groups = [],
+ ) {
+
+ $fqdn_name = join([$name, $nagios::server::zone], ".")
Felix Dahlke 2015/03/09 23:14:51 Nit: Should be single quotes.
+
+ nagios_host {$fqdn_name:
+ use => 'generic-host',
Felix Dahlke 2015/03/09 23:14:51 While the Puppet style guide actually wants us to
mathias 2015/03/16 12:07:11 Since arrow alignment is prone to indentation issu
+ hostgroups => $groups,
+ }
+ }
}

Powered by Google App Engine
This is Rietveld