From 198b84bfbe5396e289764a03f9996845d3e47b86 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Mon, 4 Jan 2010 21:46:32 -0500 Subject: change the nagios2::passive_service check so that it uses the $name variable instead of the $real_host variable because $real_host prevents us from creating more than one rdiff-backup define on a server because this will cause a duplicate defintion. The $name variable allows for multiple without creating duplicate passive_service checks --- manifests/server.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/server.pp b/manifests/server.pp index 7cd5dd1..291ffed 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -97,7 +97,7 @@ class backupninja::server { if $nagios_server { # configure a passive service check for backups - nagios2::passive_service { "backups-$real_host": nagios2_host_name => $real_host, nagios2_description => 'backups', servicegroups => "backups" } + nagios2::passive_service { "backups-$name": nagios2_host_name => $real_host, nagios2_description => 'backups', servicegroups => "backups" } } if !defined(File["$real_dir"]) { -- cgit v1.2.3 From 47733659ae1c79cd8249096455f4b0d863dcad75 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 5 Jan 2010 10:34:16 -0500 Subject: let the user override the nagios2_description, which is necessary for multiple backup defines on one host --- manifests/rdiff.pp | 3 ++- manifests/server.pp | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index 38a975d..587c02d 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -25,7 +25,7 @@ define backupninja::rdiff( "/home", "/usr/local/*bin", "/var/lib/dpkg/status*" ], $vsinclude = false, $keep = 30, $sshoptions = false, $options = '--force', $ssh_dir_manage = true, $ssh_dir = false, $authorized_keys_file = false, $installuser = true, $installkey = true, $key = false, - $backuptag = false, $home = false, $backupkeytype = "rsa", $backupkeystore = false, $extras = false) + $backuptag = false, $home = false, $backupkeytype = "rsa", $backupkeystore = false, $extras = false, $nagios2_description = 'backups') { include backupninja::client::rdiff_backup @@ -49,6 +49,7 @@ define backupninja::rdiff( manage_ssh_dir => $ssh_dir_manage, ssh_dir => $ssh_dir, key => $key, authorized_keys_file => $authorized_keys_file, installuser => $installuser, backuptag => $real_backuptag, keytype => $backupkeytype, backupkeys => $backupkeystore, + nagios2_description => $nagios2_description } backupninja::client::key diff --git a/manifests/server.pp b/manifests/server.pp index 291ffed..a64e854 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -62,7 +62,7 @@ class backupninja::server { define sandbox( $user = false, $host = false, $installuser = true, $dir = false, $manage_ssh_dir = true, $ssh_dir = false, $authorized_keys_file = false, $key = false, $keytype = 'dss', $backupkeys = false, $uid = false, - $gid = "backupninjas", $backuptag = false) + $gid = "backupninjas", $backuptag = false, $nagios2_description = "backups") { $real_user = $user ? { @@ -95,9 +95,14 @@ class backupninja::server { default => $backuptag, } + $real_nagios2_description = $nagios2_description ? { + false => "backups", + default => $nagios2_description, + } + if $nagios_server { # configure a passive service check for backups - nagios2::passive_service { "backups-$name": nagios2_host_name => $real_host, nagios2_description => 'backups', servicegroups => "backups" } + nagios2::passive_service { "backups-$name": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" } } if !defined(File["$real_dir"]) { -- cgit v1.2.3 From 8766fcdd82cdb67eb4b09f4b2f3f959c0c0ec3d0 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Tue, 5 Jan 2010 21:48:19 -0500 Subject: enclose namevar in curly braces --- manifests/server.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/server.pp b/manifests/server.pp index a64e854..a0bcbf2 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -102,7 +102,7 @@ class backupninja::server { if $nagios_server { # configure a passive service check for backups - nagios2::passive_service { "backups-$name": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" } + nagios2::passive_service { "backups-${name}": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" } } if !defined(File["$real_dir"]) { -- cgit v1.2.3 From 292dd6b41adde8ca018e7c9b0d976420dc8905bc Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 29 Jan 2010 12:20:53 -0500 Subject: allow for a version variable override for the backupninja package, instead of hard-coding the 0.9.6 release. This changes the installed version to be 'installed', and lets you specify a variable if you wish to install a different version --- README | 20 +++++++++++++------- manifests/client.pp | 7 +++++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README b/README index 18192ad..5b7c2c9 100644 --- a/README +++ b/README @@ -47,15 +47,21 @@ You may also want to set some variables on your backup server, such as: Configure your backup clients ----------------------------- -Every handler that requires certain backup software to be installed, -will handle the installation of that software, as long as you are not -handling it elsewhere in your manifests. The handler will make sure -that the correct version that is associated with puppet's 'installed' -(or 'present') parameter is installed. If you need to specify a -specific version of the programs that the class installs, you can -specify the version you need installed by providing a variable, for +The backupninja package and the necessary backup software will be +installed automatically when you include any of the different handlers +(as long as you are not handling it elsewhere in your manifests), for example: +include backupninja::client::rdiff_backup + +In this case, the module will make sure that the backupninja package +and the required rdiff-backup package are 'installed'/'present' (using +puppet's ensure parameter language). If you need to specify a specific +version of either backupninja itself, or the specific programs that +the handler class installs, you can specify the version you need +installed by providing a variable, for example: + +$backupninja_ensure_version = "0.9.7~bpo50+1" $rdiff_backup_ensure_version = "1.2.5-1~bpo40+1" $rsync_ensure_version = "3.0.6-1~bpo50+1" $duplicity_ensure_version = "0.6.04-1~bpo50+1" diff --git a/manifests/client.pp b/manifests/client.pp index 95e3905..287b02f 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -32,8 +32,11 @@ class backupninja::client::defaults { '' => true, default => $ssh_dir_manage } - package { 'backupninja': - ensure => '0.9.6-4'; + if !defined(Package["backupninja"]) { + if $backupninja_ensure_version == '' { $backupninja_ensure_version = 'installed' } + package { 'backupninja': + ensure => $backupninja_ensure_version + } } file { $configdir: ensure => directory, -- cgit v1.2.3