diff options
author | Micah Anderson <micah@riseup.net> | 2008-06-03 16:56:00 +0000 |
---|---|---|
committer | Micah Anderson <micah@riseup.net> | 2008-06-03 16:56:00 +0000 |
commit | 83a71156552df7eccd2794e8d6386b922286a130 (patch) | |
tree | ee62d2bdd89f98ee49d48f07872f41454a6308b3 | |
parent | 1abb2e62f1dc2ac374403374e5bfd6511a12de03 (diff) | |
download | puppet-backupninja-83a71156552df7eccd2794e8d6386b922286a130.tar.gz puppet-backupninja-83a71156552df7eccd2794e8d6386b922286a130.tar.bz2 |
add a way to override the automatic tag creation based on hostname
set the backuptag on crabgrass to not use the default one, otherwise
it wont be collected
-rw-r--r-- | manifests/rdiff.pp | 5 | ||||
-rw-r--r-- | manifests/server.pp | 17 |
2 files changed, 14 insertions, 8 deletions
diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp index 978b961..0a84a6b 100644 --- a/manifests/rdiff.pp +++ b/manifests/rdiff.pp @@ -27,13 +27,14 @@ define backupninja::rdiff($order = 90, $sshoptions = false, $options = false, $installuser = true, - $installkey = true + $installkey = true, + $backuptag = false ) { include backupninja::client case $type { 'remote': { case $host { false: { err("need to define a host for remote backups!") } } - backupninja::server::sandbox { "${user}-${name}": user => $user, host => $host, dir => $directory, installuser => $installuser } + backupninja::server::sandbox { "${user}-${name}": user => $user, host => $host, dir => $directory, installuser => $installuser, backuptag => $backuptag } backupninja::client::key { "${user}-${name}": user => $user, host => $host, installkey => $installkey } } } diff --git a/manifests/server.pp b/manifests/server.pp index cf65bb4..a49dc6b 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -24,7 +24,7 @@ class backupninja::server { # this define allows nodes to declare a remote backup sandbox, that have to # get created on the server - define sandbox($user = false, $host = false, $installuser = true, $dir = false, $backupkeys = false, $uid = false, $gid = "backupninjas") { + define sandbox($user = false, $host = false, $installuser = true, $dir = false, $backupkeys = false, $uid = false, $gid = "backupninjas", $backuptag = false) { $real_user = $name ? { false => $name, default => $user, @@ -42,10 +42,15 @@ class backupninja::server { false => "${backupninja::server::real_backupdir}/$fqdn", default => $dir, } + $real_backuptag = $backuptag ? { + false => "backupninja-$real_host", + default => $backuptag, + } + @@file { "$real_dir": ensure => directory, mode => 750, owner => $user, group => 0, - tag => "backupninja-$real_host", + tag => "$real_backuptag", } case $installuser { true: { @@ -53,14 +58,14 @@ class backupninja::server { ensure => directory, mode => 700, owner => $user, group => 0, require => File["$real_dir"], - tag => "backupninja-$real_host", + tag => "$real_backuptag", } @@file { "$real_dir/.ssh/authorized_keys": ensure => present, mode => 644, owner => 0, group => 0, source => "$real_backupkeys/${user}_id_rsa.pub", require => File["$real_dir/.ssh"], - tag => "backupninja-$real_host", + tag => "$real_backuptag", } case $uid { @@ -74,7 +79,7 @@ class backupninja::server { shell => "/bin/sh", password => '*', require => Group['backupninjas'], - tag => "backupninja-$real_host" + tag => "$real_backuptag" } } default: { @@ -88,7 +93,7 @@ class backupninja::server { shell => "/bin/sh", password => '*', require => Group['backupninjas'], - tag => "backupninja-$real_host" + tag => "$real_backuptag" } } } |