aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-06-05 16:49:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-06-05 16:49:46 -0300
commite188dd8faa0e3b5cf033abf2e5eab000c06dc889 (patch)
tree3235c1033d88d659359f709f3758bb09979173ce /manifests
parentb17704f7cd7897d100d4ebcf6f068858d626e4a5 (diff)
downloadpuppet-backupninja-e188dd8faa0e3b5cf033abf2e5eab000c06dc889.tar.gz
puppet-backupninja-e188dd8faa0e3b5cf033abf2e5eab000c06dc889.tar.bz2
Trying a different approach to realize exported resources
Diffstat (limited to 'manifests')
-rw-r--r--manifests/server.pp48
1 files changed, 14 insertions, 34 deletions
diff --git a/manifests/server.pp b/manifests/server.pp
index ea7d327..40e9004 100644
--- a/manifests/server.pp
+++ b/manifests/server.pp
@@ -1,3 +1,9 @@
+define backupninja_server_realize($host) {
+ User <<| tag == "backupninja-$host" |>>
+ File <<| tag == "backupninja-$host" |>>
+ Ssh_authorized_key <<| tag == "backupninja-$host" |>>
+}
+
class backupninja::server {
$real_backupdir = $backupdir ? {
@@ -46,9 +52,8 @@ class backupninja::server {
}
}
- User <<| tag == "backupninja-$real_backupserver_tag" |>>
- File <<| tag == "backupninja-$real_backupserver_tag" |>>
- Ssh_authorized_key <<| tag == "backupninja-$real_backupserver_tag" |>>
+ # collect all resources from hosted backups
+ Backupninja_server_realize <| tag == "$real_backupserver_tag" |>
if !defined(Package["rsync"]) {
if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' }
@@ -91,7 +96,7 @@ class backupninja::server {
default => $authorized_keys_file,
}
$real_backuptag = $backuptag ? {
- false => "backupninja-$real_host",
+ false => "backupninja-$fqdn",
default => $backuptag,
}
@@ -105,6 +110,11 @@ class backupninja::server {
nagios2::passive_service { "backups-${name}": nagios2_host_name => $real_host, nagios2_description => $real_nagios2_description, servicegroups => "backups" }
}
+ @@backupninja_server_realize { "${fqdn}-${real_host}":
+ host => $fqdn,
+ tag => $real_host,
+ }
+
if !defined(File["$real_dir"]) {
@@file { "$real_dir":
ensure => directory,
@@ -112,11 +122,6 @@ class backupninja::server {
tag => "$real_backuptag",
}
}
- else {
- File["$real_dir"] {
- tag +> "$real_backuptag",
- }
- }
case $installuser {
true: {
case $manage_ssh_dir {
@@ -129,11 +134,6 @@ class backupninja::server {
tag => "$real_backuptag",
}
}
- else {
- File["$real_ssh_dir"] {
- tag +> "$real_backuptag",
- }
- }
}
}
case $key {
@@ -147,11 +147,6 @@ class backupninja::server {
tag => "$real_backuptag",
}
}
- else {
- File["${real_ssh_dir}/${real_authorized_keys_file}"] {
- tag +> "$real_backuptag",
- }
- }
}
default: {
if !defined(Ssh_autorized_key["$real_user"]) {
@@ -164,11 +159,6 @@ class backupninja::server {
require => User[$real_user],
}
}
- else {
- Ssh_authorized_key["$real_user"] {
- tag +> "$real_backuptag",
- }
- }
}
}
case $uid {
@@ -186,11 +176,6 @@ class backupninja::server {
tag => "$real_backuptag"
}
}
- else {
- User["$real_user"] {
- tag +> "$real_backuptag",
- }
- }
}
default: {
if !defined(User["$real_user"]) {
@@ -207,11 +192,6 @@ class backupninja::server {
tag => "$real_backuptag"
}
}
- else {
- User["$real_user"] {
- tag +> "$real_backuptag",
- }
- }
}
}
}