From 132bae5004456dc9fb146b35b1c6b29573fd13b6 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Sat, 3 Jan 2009 18:12:23 -0500 Subject: upgrade backupninja version to the version that will be shipped with lenny --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index c98bced..66dbd1c 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -32,7 +32,7 @@ class backupninja::client { default => $ssh_dir_manage } package { 'backupninja': - ensure => '0.9.6-3'; + ensure => '0.9.6-4'; } file { $configdir: ensure => directory -- cgit v1.2.3 From cbcacb7da154f1be8105ef69466744889b2b6c45 Mon Sep 17 00:00:00 2001 From: Matt Taggart Date: Wed, 15 Jul 2009 13:05:21 -0700 Subject: create subclasses for maildir and rdiff-backup. If you are using these features of backupninja, you'll want to switch to doing "include backupninja::client::maildir" for the machines that need it and this will pull in backupninja::client, so you don't need to include that anymore if you were explicitly doing so for those machines (although it shouldn't hurt). Right now what using these new subclasses will get you is dependencies on needed packages, but in the future there might be more. --- manifests/client.pp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index 66dbd1c..999108c 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -86,4 +86,28 @@ class backupninja::client { } } +class backupninja::client::maildir inherits backupninja::client { + case $rsync_ensure_version { + '': { $rsync_ensure_version = "present" } + } + if !defined(Package["rsync"]) { + if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' } + package { 'rsync': + ensure => $rsync_ensure_version, + } + } +} + +class backupninja::client::rdiff-backup inherits backupninja::client { + case $rdiff-backup_ensure_version { + '': { $rdiff-backup_ensure_version = "present" } + } + + if !defined(Package["rdiff-backup"]) { + if $rdiff-backup_ensure_version == '' { $rdiff-backup_ensure_version = 'installed' } + package { 'rdiff-backup': + ensure => $rdiff-backup_ensure_version, + } + } +} -- cgit v1.2.3 From 00d3218d1ced516b6cb555155a631c0071d46d80 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 15 Jul 2009 17:10:21 -0400 Subject: remove redundant case statements which tested to see if the package ensure version variables were set changed the $rdiff-backup_ensure_version variable to $rdiff_backup_ensure_version as dashes are not allowed in variable names --- manifests/client.pp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index 999108c..d799014 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -87,9 +87,6 @@ class backupninja::client { } class backupninja::client::maildir inherits backupninja::client { - case $rsync_ensure_version { - '': { $rsync_ensure_version = "present" } - } if !defined(Package["rsync"]) { if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' } @@ -100,14 +97,11 @@ class backupninja::client::maildir inherits backupninja::client { } class backupninja::client::rdiff-backup inherits backupninja::client { - case $rdiff-backup_ensure_version { - '': { $rdiff-backup_ensure_version = "present" } - } if !defined(Package["rdiff-backup"]) { - if $rdiff-backup_ensure_version == '' { $rdiff-backup_ensure_version = 'installed' } + if $rdiff_backup_ensure_version == '' { $rdiff_backup_ensure_version = 'installed' } package { 'rdiff-backup': - ensure => $rdiff-backup_ensure_version, + ensure => $rdiff_backup_ensure_version, } } } -- cgit v1.2.3 From d5acd326fc1454874a59b83a17e2621be7245ea9 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Wed, 15 Jul 2009 17:13:44 -0400 Subject: fix rdiff-backup class name, "You can use Aa-Zz, 0-9 and underscores in variables, resources and class names." which means no dashes in class names either --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index d799014..a3d2242 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -96,7 +96,7 @@ class backupninja::client::maildir inherits backupninja::client { } } -class backupninja::client::rdiff-backup inherits backupninja::client { +class backupninja::client::rdiff_backup inherits backupninja::client { if !defined(Package["rdiff-backup"]) { if $rdiff_backup_ensure_version == '' { $rdiff_backup_ensure_version = 'installed' } -- cgit v1.2.3 From 6734c256525e1dd42ba3648db82083bcabca66ed Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 26 Aug 2009 22:48:57 -0300 Subject: Avoiding duplicate file definitions at backupninja::client::key --- manifests/client.pp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index a3d2242..8368eb4 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -72,14 +72,18 @@ class backupninja::client { case $install_key { true: { - file { "${backupninja::client::real_keydestination}": - ensure => directory, - mode => 0700, owner => $key_owner, group => $key_group, + if !defined(File["${backupninja::client::real_keydestination}"]) { + file { "${backupninja::client::real_keydestination}": + ensure => directory, + mode => 0700, owner => $key_owner, group => $key_group, + } } - file { "${backupninja::client::real_keydestination}/id_${key_type}": - source => "${key_store}/${real_user}_id_${key_type}", - mode => 0400, owner => $key_owner, group => $key_group, - require => File["${backupninja::client::real_keydestination}"], + if !defined(File["${backupninja::client::real_keydestination/id_${key_type}"]) { + file { "${backupninja::client::real_keydestination}/id_${key_type}": + source => "${key_store}/${real_user}_id_${key_type}", + mode => 0400, owner => $key_owner, group => $key_group, + require => File["${backupninja::client::real_keydestination}"], + } } } } -- cgit v1.2.3 From a7c710bda474a08a8902978069bcc3227ba5f223 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Thu, 27 Aug 2009 15:43:52 -0400 Subject: * add duplicity package management class to the client class * update the README to be more clear about how this works, provide more examples and included details about the addition of the backupninja::client::duplicity class --- manifests/client.pp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index a3d2242..ef449f5 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -105,3 +105,14 @@ class backupninja::client::rdiff_backup inherits backupninja::client { } } } + +class backupninja::client::duplicity inherits backupninja::client { + + if !defined(Package["duplicity"]) { + if $duplicity_ensure_version == '' { $duplicity_ensure_version = 'installed' } + package { 'duplicity': + ensure => $duplicity_ensure_version, + } + } +} + -- cgit v1.2.3 From 7a77206c6003835f45a3a07ecb4a7f29af29d9d0 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 27 Aug 2009 21:30:21 -0300 Subject: Adding additional clause to avoid blank keytype --- manifests/client.pp | 1 + 1 file changed, 1 insertion(+) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index c3d186d..04001e7 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -66,6 +66,7 @@ class backupninja::client { default => $keystore, } $key_type = $keytype ? { + '' => "${backupninja::client::real_keytype}", false => "${backupninja::client::real_keytype}", default => $keytype, } -- cgit v1.2.3 From 31414022aba5918ba5678e27e362bf134848dbe1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 27 Aug 2009 21:45:04 -0300 Subject: Adding additional clause to avoid blank real_keytype --- manifests/client.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index 04001e7..fa64510 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -8,7 +8,8 @@ class backupninja::client { default => $backupkeystore, } $real_keytype = $backupkeytype ? { - '' => 'rsa', + '' => 'rsa', + false => 'rsa', default => $backupkeytype, } $real_keydestination = $keydestination ? { -- cgit v1.2.3 From b432d94fa72162aa9635217b703ad100b9d39fa2 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Aug 2009 17:17:25 -0300 Subject: New backupninja::client::defaults to avoid duplicates. Adding part of client.pp code into new class backupninja::client::defaults in an attempt to avoid duplicate definitions inside backupninja::client::key. --- manifests/client.pp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index fa64510..f8c5e23 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -1,4 +1,4 @@ -class backupninja::client { +class backupninja::client::defaults { $configdir = $cfg_override ? { '' => "/etc/backup.d", default => $cfg_override, @@ -38,6 +38,9 @@ class backupninja::client { file { $configdir: ensure => directory } +} + +class backupninja::client inherits backupninja::client::defaults { define key( $user = false, $host = false, $installkey=false, $keyowner=false, $keygroup=false, $keystore=false, $keytype=false) @@ -51,40 +54,40 @@ class backupninja::client { default => $host } $install_key = $installkey ? { - false => "${backupninja::client::real_keymanage}", + false => "${backupninja::client::defaults::real_keymanage}", default => $installkey, } $key_owner = $keyowner ? { - false => "${backupninja::client::real_keyowner}", + false => "${backupninja::client::defaults::real_keyowner}", default => $keyowner, } $key_group = $keygroup ? { - false => "${backupninja::client::real_keygroup}", + false => "${backupninja::client::defaults::real_keygroup}", default => $keygroup, } $key_store = $keystore ? { - false => "${backupninja::client::real_keystore}", + false => "${backupninja::client::defaults::real_keystore}", default => $keystore, } $key_type = $keytype ? { - '' => "${backupninja::client::real_keytype}", - false => "${backupninja::client::real_keytype}", + '' => "${backupninja::client::defaults::real_keytype}", + false => "${backupninja::client::defaults::real_keytype}", default => $keytype, } case $install_key { true: { - if !defined(File["${backupninja::client::real_keydestination}"]) { - file { "${backupninja::client::real_keydestination}": + if !defined(File["${backupninja::client::defaults::real_keydestination}"]) { + file { "${backupninja::client::defaults::real_keydestination}": ensure => directory, mode => 0700, owner => $key_owner, group => $key_group, } } - if !defined(File["${backupninja::client::real_keydestination/id_${key_type}"]) { - file { "${backupninja::client::real_keydestination}/id_${key_type}": + if !defined(File["${backupninja::client::defaults::real_keydestination/id_${key_type}"]) { + file { "${backupninja::client::defaults::real_keydestination}/id_${key_type}": source => "${key_store}/${real_user}_id_${key_type}", mode => 0400, owner => $key_owner, group => $key_group, - require => File["${backupninja::client::real_keydestination}"], + require => File["${backupninja::client::defaults::real_keydestination}"], } } } @@ -92,7 +95,7 @@ class backupninja::client { } } -class backupninja::client::maildir inherits backupninja::client { +class backupninja::client::maildir inherits backupninja::client::defaults { if !defined(Package["rsync"]) { if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' } @@ -102,7 +105,7 @@ class backupninja::client::maildir inherits backupninja::client { } } -class backupninja::client::rdiff_backup inherits backupninja::client { +class backupninja::client::rdiff_backup inherits backupninja::client::defaults { if !defined(Package["rdiff-backup"]) { if $rdiff_backup_ensure_version == '' { $rdiff_backup_ensure_version = 'installed' } @@ -112,7 +115,7 @@ class backupninja::client::rdiff_backup inherits backupninja::client { } } -class backupninja::client::duplicity inherits backupninja::client { +class backupninja::client::duplicity inherits backupninja::client::defaults { if !defined(Package["duplicity"]) { if $duplicity_ensure_version == '' { $duplicity_ensure_version = 'installed' } -- cgit v1.2.3 From 5fe3a1b401fbac378a8ed802518da5fb2420f17e Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Aug 2009 17:54:25 -0300 Subject: Trying a different way to test definitions at backupninja::client::key --- manifests/client.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index f8c5e23..869e75b 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -75,15 +75,18 @@ class backupninja::client inherits backupninja::client::defaults { default => $keytype, } + $key_dest = "${backupninja::client::defaults::real_keydestination}" + $key_dest_file = "$key_dest/id_$key_type" + case $install_key { true: { - if !defined(File["${backupninja::client::defaults::real_keydestination}"]) { + if !defined(File["$key_dest"]) { file { "${backupninja::client::defaults::real_keydestination}": ensure => directory, mode => 0700, owner => $key_owner, group => $key_group, } } - if !defined(File["${backupninja::client::defaults::real_keydestination/id_${key_type}"]) { + if !defined(File["$key_dest_file"]) { file { "${backupninja::client::defaults::real_keydestination}/id_${key_type}": source => "${key_store}/${real_user}_id_${key_type}", mode => 0400, owner => $key_owner, group => $key_group, -- cgit v1.2.3 From cf23487312c5c478b10f3443e31d7edc64b15448 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Aug 2009 17:59:17 -0300 Subject: Trying a different way to test definitions at backupninja::client::key (2) --- manifests/client.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index 869e75b..134a7e1 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -81,13 +81,13 @@ class backupninja::client inherits backupninja::client::defaults { case $install_key { true: { if !defined(File["$key_dest"]) { - file { "${backupninja::client::defaults::real_keydestination}": + file { "$key_dest": ensure => directory, mode => 0700, owner => $key_owner, group => $key_group, } } if !defined(File["$key_dest_file"]) { - file { "${backupninja::client::defaults::real_keydestination}/id_${key_type}": + file { "$key_dest_file": source => "${key_store}/${real_user}_id_${key_type}", mode => 0400, owner => $key_owner, group => $key_group, require => File["${backupninja::client::defaults::real_keydestination}"], -- cgit v1.2.3 From 7e26b6e6ef286313cc79563a5da6333433da4204 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Aug 2009 18:19:35 -0300 Subject: Trying a different way to test definitions at backupninja::client::key (3) --- manifests/client.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/client.pp') diff --git a/manifests/client.pp b/manifests/client.pp index 134a7e1..c21e669 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -90,7 +90,7 @@ class backupninja::client inherits backupninja::client::defaults { file { "$key_dest_file": source => "${key_store}/${real_user}_id_${key_type}", mode => 0400, owner => $key_owner, group => $key_group, - require => File["${backupninja::client::defaults::real_keydestination}"], + require => File["$key_dest"], } } } -- cgit v1.2.3