aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/backupninja.pp5
-rw-r--r--manifests/config.pp22
-rw-r--r--manifests/init.pp1
-rw-r--r--manifests/mysql.pp51
-rw-r--r--manifests/null_class.pp2
-rw-r--r--manifests/rdiff.pp52
6 files changed, 133 insertions, 0 deletions
diff --git a/manifests/backupninja.pp b/manifests/backupninja.pp
new file mode 100644
index 0000000..1de0f55
--- /dev/null
+++ b/manifests/backupninja.pp
@@ -0,0 +1,5 @@
+class backupninja {
+ package { 'backupninja':
+ ensure => present
+ }
+}
diff --git a/manifests/config.pp b/manifests/config.pp
new file mode 100644
index 0000000..7cf5b1a
--- /dev/null
+++ b/manifests/config.pp
@@ -0,0 +1,22 @@
+# Write a "main" configuration file for backupninja. Effectively, it does
+# little more than just take the config options you specify in the define and
+# write them to the config file as-is.
+#
+define backupninja::config($configfile = '/etc/backupninja.conf',
+ $loglvl = 4,
+ $when = '01:00',
+ $reportemail = 'root',
+ $reportsuccess = false,
+ $reportwarning = true,
+ $logfile = '/var/log/backupninja.log',
+ $configdir = '/etc/backup.d',
+ $scriptdir = '/usr/share/backupninja',
+ $usecolors = true
+ ) {
+ file { $configfile:
+ content => template('backupninja/backupninja.conf.erb'),
+ owner => root,
+ group => root,
+ mode => 0644
+ }
+}
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..0da5d18
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1 @@
+import "*.pp"
diff --git a/manifests/mysql.pp b/manifests/mysql.pp
new file mode 100644
index 0000000..92f6729
--- /dev/null
+++ b/manifests/mysql.pp
@@ -0,0 +1,51 @@
+# Safe MySQL dumps, as part of a backupninja run.
+#
+# Valid attributes for this type are:
+#
+# configdir: The directory to write the handler config file into.
+#
+# order: The prefix to give to the handler config filename, to set
+# order in which the actions are executed during the backup run.
+#
+# ensure: Allows you to delete an entry if you don't want it any more
+# (but be sure to keep the configdir, name, and order the same, so
+# that we can find the correct file to remove).
+#
+# user, dbusername, dbpassword, dbhost, databases, backupdir, hotcopy,
+# sqldump, compress: As defined in the backupninja documentation, with the
+# caveat that hotcopy, sqldump, and compress take true/false rather
+# than yes/no.
+#
+define backupninja::mysql($configdir = '/etc/backup.d',
+ $order = 10,
+ $ensure = present,
+ $user = false,
+ $dbusername = false,
+ $dbpassword = false,
+ $dbhost = 'localhost',
+ $databases = 'all',
+ $backupdir = false,
+ $hotcopy = false,
+ $sqldump = false,
+ $compress = false
+ ) {
+ # Make sure the directory that the config goes into exists already
+ if defined(File["${configdir}"]) {
+ # Yay for a lack of a negation operator, and the inability
+ # to provide empty blocks
+ include null_class
+ } else {
+ file { $configdir:
+ ensure => directory
+ }
+ }
+
+ file { "${configdir}/${order}_${name}.mysql":
+ ensure => $ensure,
+ content => template('backupninja/mysql.conf.erb'),
+ owner => root,
+ group => root,
+ mode => 0600,
+ require => File["${configdir}"]
+ }
+}
diff --git a/manifests/null_class.pp b/manifests/null_class.pp
new file mode 100644
index 0000000..9279d87
--- /dev/null
+++ b/manifests/null_class.pp
@@ -0,0 +1,2 @@
+class null_class {
+}
diff --git a/manifests/rdiff.pp b/manifests/rdiff.pp
new file mode 100644
index 0000000..9183ef1
--- /dev/null
+++ b/manifests/rdiff.pp
@@ -0,0 +1,52 @@
+# Run rdiff-backup as part of a backupninja run.
+#
+# Valid attributes for this type are:
+#
+# configdir: The directory to write the handler config file into.
+#
+# order: The prefix to give to the handler config filename, to set
+# order in which the actions are executed during the backup run.
+#
+# ensure: Allows you to delete an entry if you don't want it any more
+# (but be sure to keep the configdir, name, and order the same, so
+# that we can find the correct file to remove).
+#
+# keep, include, exclude, type, host, directory, user, sshoptions: As
+# defined in the backupninja documentation. The options will be placed
+# in the correct sections automatically. The include and exclude
+# options should be given as arrays if you want to specify multiple
+# directories.
+#
+define backupninja::rdiff($configdir = '/etc/backup.d',
+ $order = 90,
+ $ensure = present,
+ $user = false,
+ $directory = false,
+ $host = false,
+ $type = 'local',
+ $exclude = false,
+ $include = false,
+ $keep = 30,
+ $sshoptions = false,
+ $options = false
+ ) {
+ # Make sure the directory that the config goes into exists already
+ if defined(File["${configdir}"]) {
+ # Yay for a lack of a negation operator, and the inability
+ # to provide empty blocks
+ include null_class
+ } else {
+ file { $configdir:
+ ensure => directory
+ }
+ }
+
+ file { "${configdir}/${order}_${name}.rdiff":
+ ensure => $ensure,
+ content => template('backupninja/rdiff.conf.erb'),
+ owner => root,
+ group => root,
+ mode => 0600,
+ require => File["${configdir}"]
+ }
+}