From c1e5fe085837af4c5569404619c77310d4285253 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Wed, 7 Apr 2010 10:58:12 -0400 Subject: add ability to register a non-puppet-managed munin node --- manifests/register.pp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'manifests/register.pp') diff --git a/manifests/register.pp b/manifests/register.pp index e1271e1..59500a0 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,10 +1,23 @@ -define munin::register() +define munin::register( + $host = 'absent', + $port = 'absent' +) { - $munin_port_real = $munin_port ? { '' => 4949, default => $munin_port } - $munin_host_real = $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_host + $munin_port_real = $port ? { + 'absent' => $munin_port ? { + '' => 4949, + default => $munin_port + }, + default => $port + } + + $munin_host_real = $host ? { + 'absent' => $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + }, + default => $host } @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": -- cgit v1.2.3 From 4591a91f7a8b169d0aa3ccb46357c60f8dcb7079 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Thu, 13 May 2010 14:12:07 -0400 Subject: remove tabs and trailing whitespaces in manifests --- manifests/register.pp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'manifests/register.pp') diff --git a/manifests/register.pp b/manifests/register.pp index 59500a0..05d8f2a 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -3,7 +3,7 @@ define munin::register( $port = 'absent' ) { - $munin_port_real = $port ? { + $munin_port_real = $port ? { 'absent' => $munin_port ? { '' => 4949, default => $munin_port @@ -11,20 +11,20 @@ define munin::register( default => $port } - $munin_host_real = $host ? { + $munin_host_real = $host ? { 'absent' => $munin_host ? { '' => $fqdn, 'fqdn' => $fqdn, default => $munin_host }, default => $host - } + } - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": - ensure => present, - content => template("munin/defaultclient.erb"), - tag => 'munin', - } + @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + ensure => present, + content => template("munin/defaultclient.erb"), + tag => 'munin', + } } -- cgit v1.2.3 From f1586a7fbcc79fee6542790b1f4c930929af7e04 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Fri, 14 May 2010 11:02:03 -0400 Subject: refactor register class and client template --- manifests/register.pp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) (limited to 'manifests/register.pp') diff --git a/manifests/register.pp b/manifests/register.pp index 05d8f2a..21f1d35 100644 --- a/manifests/register.pp +++ b/manifests/register.pp @@ -1,30 +1,34 @@ -define munin::register( +define munin::register ( $host = 'absent', - $port = 'absent' + $port = 'absent', + $description = 'absent', + $config = [] ) { + $fhost = $name + $client_type = 'client' + $munin_port_real = $port ? { - 'absent' => $munin_port ? { - '' => 4949, - default => $munin_port - }, - default => $port - } + 'absent' => $munin_port ? { + '' => 4949, + default => $munin_port + }, + default => $port + } $munin_host_real = $host ? { - 'absent' => $munin_host ? { - '' => $fqdn, - 'fqdn' => $fqdn, - default => $munin_host - }, - default => $host + 'absent' => $munin_host ? { + '' => $fqdn, + 'fqdn' => $fqdn, + default => $munin_host + }, + default => $host } - @@file { "/var/lib/puppet/modules/munin/nodes/${name}_${munin_port_real}": + @@file { "munin_client_${fhost}_${munin_port_real}": ensure => present, - content => template("munin/defaultclient.erb"), + path => "/var/lib/puppet/modules/munin/nodes/${fhost}_${munin_port_real}", + content => template("munin/client.erb"), tag => 'munin', } } - - -- cgit v1.2.3