diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-06-05 15:12:30 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-06-05 15:12:30 -0300 |
commit | ead754fe1a36cafa88d5251f9561bec44d5aac1f (patch) | |
tree | 379677f37a1bc4bdb46091db4452c447d41d449c | |
parent | 9561932b03ea52f434654157d8348ffa95325f5e (diff) | |
download | puppet-backupninja-ead754fe1a36cafa88d5251f9561bec44d5aac1f.tar.gz puppet-backupninja-ead754fe1a36cafa88d5251f9561bec44d5aac1f.tar.bz2 |
Using namevars to deal with multiple backup destinations
-rw-r--r-- | manifests/server.pp | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/manifests/server.pp b/manifests/server.pp index b6d16b1..382764b 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -105,31 +105,34 @@ class backupninja::server { nagios2::passive_service { "backups-${name}": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" } } - if !defined(File["$real_dir"]) { - @@file { "$real_dir": + if !defined(File["$real_backuptag-$real_dir"]) { + @@file { "$real_backuptag-$real_dir": + path => "$real_dir", ensure => directory, - mode => 0750, owner => $real_user, group => 0, - tag => "$real_backuptag", + mode => 0750, owner => $real_user, group => 0, + tag => "$real_backuptag", } } case $installuser { true: { case $manage_ssh_dir { true: { - if !defined(File["$real_ssh_dir"]) { - @@file { "${real_ssh_dir}": - ensure => directory, - mode => 0700, owner => $real_user, group => 0, + if !defined(File["$real_backuptag-$real_ssh_dir"]) { + @@file { "$real_backuptag-${real_ssh_dir}": + path => "${real_ssh_dir}", + ensure => directory, + mode => 0700, owner => $real_user, group => 0, require => [User[$real_user], File["$real_dir"]], - tag => "$real_backuptag", + tag => "$real_backuptag", } } } } case $key { false: { - if !defined(File["${real_ssh_dir}/${real_authorized_keys_file}"]) { - @@file { "${real_ssh_dir}/${real_authorized_keys_file}": + if !defined(File["$real_backuptag-${real_ssh_dir}/${real_authorized_keys_file}"]) { + @@file { "$real_backuptag-${real_ssh_dir}/${real_authorized_keys_file}": + path => "${real_ssh_dir}/${real_authorized_keys_file", ensure => present, mode => 0644, owner => 0, group => 0, source => "$real_backupkeys/${real_user}_id_${keytype}.pub", @@ -139,8 +142,9 @@ class backupninja::server { } } default: { - if !defined(Ssh_autorized_key["$real_user"]) { - @@ssh_authorized_key{ "$real_user": + if !defined(Ssh_autorized_key["$real_backuptag-$real_user"]) { + @@ssh_authorized_key{ "$real_backuptag-$real_user": + name => "$real_user", type => $keytype, key => $key, user => $real_user, @@ -153,8 +157,9 @@ class backupninja::server { } case $uid { false: { - if !defined(User["$real_user"]) { - @@user { "$real_user": + if !defined(User["$real_backuptag-$real_user"]) { + @@user { "$real_backuptag-$real_user": + name => "$real_user", ensure => "present", gid => "$gid", comment => "$name backup sandbox", @@ -168,8 +173,9 @@ class backupninja::server { } } default: { - if !defined(User["$real_user"]) { - @@user { "$real_user": + if !defined(User["$real_backuptag-$real_user"]) { + @@user { "$real_backuptag-$real_user": + name => "$real_user", ensure => "present", uid => "$uid", gid => "$gid", |