aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-03-27 12:51:24 -0400
committerJerome Charaoui <jcharaoui@cmaisonneuve.qc.ca>2015-04-17 17:11:20 -0400
commit32c44017f80fe617935d35cd4207599baf9ab7d8 (patch)
treee465ce4437b1669e90b066c88becbcce2b53aa5f
parent058ebe28086cd53f6fe86b794d6b658c95124ed7 (diff)
downloadpuppet-backupninja-32c44017f80fe617935d35cd4207599baf9ab7d8.tar.gz
puppet-backupninja-32c44017f80fe617935d35cd4207599baf9ab7d8.tar.bz2
move package declarations in base resources and wrap with ensure_resource
-rw-r--r--manifests/client/duplicity.pp9
-rw-r--r--manifests/client/maildir.pp9
-rw-r--r--manifests/client/rdiff_backup.pp9
-rw-r--r--manifests/client/rsync.pp9
-rw-r--r--manifests/client/sys.pp19
-rw-r--r--manifests/duplicity.pp4
-rw-r--r--manifests/maildir.pp8
-rw-r--r--manifests/rdiff.pp7
-rw-r--r--manifests/rsync.pp6
-rw-r--r--manifests/sys.pp12
10 files changed, 29 insertions, 63 deletions
diff --git a/manifests/client/duplicity.pp b/manifests/client/duplicity.pp
deleted file mode 100644
index 938ff3f..0000000
--- a/manifests/client/duplicity.pp
+++ /dev/null
@@ -1,9 +0,0 @@
-class backupninja::client::duplicity inherits backupninja::client::defaults {
-
- if !defined(Package["duplicity"]) {
- if $duplicity_ensure_version == '' { $duplicity_ensure_version = 'installed' }
- package { 'duplicity':
- ensure => $duplicity_ensure_version,
- }
- }
-}
diff --git a/manifests/client/maildir.pp b/manifests/client/maildir.pp
deleted file mode 100644
index 65f8aee..0000000
--- a/manifests/client/maildir.pp
+++ /dev/null
@@ -1,9 +0,0 @@
-class backupninja::client::maildir inherits backupninja::client::defaults {
-
- if !defined(Package["rsync"]) {
- if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' }
- package { 'rsync':
- ensure => $rsync_ensure_version,
- }
- }
-}
diff --git a/manifests/client/rdiff_backup.pp b/manifests/client/rdiff_backup.pp
deleted file mode 100644
index 9b098bf..0000000
--- a/manifests/client/rdiff_backup.pp
+++ /dev/null
@@ -1,9 +0,0 @@
-class backupninja::client::rdiff_backup inherits backupninja::client::defaults {
-
- if !defined(Package["rdiff-backup"]) {
- if $rdiff_backup_ensure_version == '' { $rdiff_backup_ensure_version = 'installed' }
- package { 'rdiff-backup':
- ensure => $rdiff_backup_ensure_version,
- }
- }
-}
diff --git a/manifests/client/rsync.pp b/manifests/client/rsync.pp
deleted file mode 100644
index ec92b56..0000000
--- a/manifests/client/rsync.pp
+++ /dev/null
@@ -1,9 +0,0 @@
-class backupninja::client::rsync inherits backupninja::client::defaults {
-
- if !defined(Package["rsync"]) {
- if $rsync_ensure_version == '' { $rsync_ensure_version = 'installed' }
- package { 'rsync':
- ensure => $rsync_ensure_version,
- }
- }
-}
diff --git a/manifests/client/sys.pp b/manifests/client/sys.pp
deleted file mode 100644
index c038060..0000000
--- a/manifests/client/sys.pp
+++ /dev/null
@@ -1,19 +0,0 @@
-class backupninja::client::sys inherits backupninja::client::defaults {
- case $operatingsystem {
- debian,ubuntu: {
- if !defined(Package["debconf-utils"]) {
- if $debconf_utils_ensure_version == '' { $debconf_utils_ensure_version = 'installed' }
- package { 'debconf-utils':
- ensure => $debconf_utils_ensure_version,
- }
- }
- if !defined(Package["hwinfo"]) {
- if $hwinfo_ensure_version == '' { $hwinfo_ensure_version = 'installed' }
- package { 'hwinfo':
- ensure => $hwinfo_ensure_version,
- }
- }
- }
- default: {}
- }
-}
diff --git a/manifests/duplicity.pp b/manifests/duplicity.pp
index 99b64f8..8313eb9 100644
--- a/manifests/duplicity.pp
+++ b/manifests/duplicity.pp
@@ -39,6 +39,7 @@
# testing debian repositories by the time of this writing.
define backupninja::duplicity( $order = 90,
$ensure = present,
+ $ensure_duplicity_version = 'installed',
# options to the config file
$options = false,
$nicelevel = false,
@@ -96,6 +97,9 @@ define backupninja::duplicity( $order = 90,
$createkey = false,
$installkey = true ) {
+ # install client dependencies
+ ensure_resource('package', 'duplicity', {'ensure' => $ensure_duplicity_version})
+
# the client with configs for this machine
include backupninja::client::duplicity
diff --git a/manifests/maildir.pp b/manifests/maildir.pp
index ab7ff55..c394a5c 100644
--- a/manifests/maildir.pp
+++ b/manifests/maildir.pp
@@ -17,13 +17,15 @@
#
#
define backupninja::maildir(
- $order = 99, $ensure = present, $when = 'everyday at 21:00', $srcdir = false,
+ $order = 99, $ensure = present, $ensure_rsync_version = 'installed',
+ $when = 'everyday at 21:00', $srcdir = false,
$destdir = false, $desthost = false, $destuser = false, $destid_file = false,
$remove = false, $multiconnection = yes, $keepdaily='4', $keepweekly='2',
$keepmonthly='2')
{
- include backupninja::client::maildir
-
+ # install client dependencies
+ ensure_resource('package', 'rsync', {'ensure' => $ensure_rsync_version})
+
case $srcdir { false: { err("need to define a source directory to backup!") } }
case $destdir { false: { err("need to define a destination directory to backup!") } }
case $desthost { false: { err("need to define a destination host for backups!") } }
diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp
index 6c692c7..bd88859 100644
--- a/manifests/rdiff.pp
+++ b/manifests/rdiff.pp
@@ -16,8 +16,8 @@
# directories.
#
define backupninja::rdiff(
- $order = 90, $ensure = present, $user = false,
- $home = "/home/${user}-${name}", $host = false,
+ $order = 90, $ensure = present, $ensure_rdiffbackup_version = 'installed',
+ $user = false, $home = "/home/${user}-${name}", $host = false,
$type = 'local',
$exclude = [ "/home/*/.gnupg", "/home/*/.local/share/Trash", "/home/*/.Trash",
"/home/*/.thumbnails", "/home/*/.beagle", "/home/*/.aMule",
@@ -28,7 +28,8 @@ define backupninja::rdiff(
$ssh_dir = false, $authorized_keys_file = false, $installuser = true, $installkey = true, $key = false,
$backuptag = false, $backupkeytype = "rsa", $backupkeystore = false, $extras = false, $nagios2_description = 'backups')
{
- include backupninja::client::rdiff_backup
+ # install client dependencies
+ ensure_resource('package', 'rdiff-backup', {'ensure' => $ensure_rdiffbackup_version})
$directory = "$home/rdiff-backup/"
diff --git a/manifests/rsync.pp b/manifests/rsync.pp
index 1c82889..7398265 100644
--- a/manifests/rsync.pp
+++ b/manifests/rsync.pp
@@ -2,7 +2,8 @@
# Based on backupninja::rdiff
define backupninja::rsync(
- $order = 90, $ensure = present, $user = false, $home = false, $host = false,
+ $order = 90, $ensure = present, $ensure_rsync_version = 'installed',
+ $user = false, $home = false, $host = false,
$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,
@@ -29,7 +30,8 @@ define backupninja::rsync(
$rm = false, $cp = false, $touch = false, $mv = false, $fsck = false)
{
- include backupninja::client::rsync
+ # install client dependencies
+ ensure_resource('package', 'rsync', {'ensure' => $ensure_rsync_version})
# Right now just local origin with remote destination is supported.
$from = 'local'
diff --git a/manifests/sys.pp b/manifests/sys.pp
index 7de319c..ceaab98 100644
--- a/manifests/sys.pp
+++ b/manifests/sys.pp
@@ -12,6 +12,8 @@
#
define backupninja::sys($order = 30,
$ensure = present,
+ $ensure_debconfutils_version = 'installed',
+ $ensure_hwinfo_version = 'installed',
$parentdir = '/var/backups',
$packages = true,
$packagesfile = '/var/backups/dpkg-selections.txt',
@@ -25,6 +27,16 @@ define backupninja::sys($order = 30,
$dolvm = false
) {
include backupninja::client::defaults
+
+ # install client dependencies
+ case $operatingsystem {
+ debian,ubuntu: {
+ ensure_resource('package', 'debconf-utils', {'ensure' => $ensure_debconfutils_version})
+ ensure_resource('package', 'hwinfo', {'ensure' => $ensure_hwinfo_version})
+ }
+ default: {}
+ }
+
file { "${backupninja::client::defaults::configdir}/${order}_${name}.sys":
ensure => $ensure,
content => template('backupninja/sys.conf.erb'),