aboutsummaryrefslogtreecommitdiff
path: root/manifests
diff options
context:
space:
mode:
Diffstat (limited to 'manifests')
-rw-r--r--manifests/init.pp91
1 files changed, 91 insertions, 0 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..2f6e2b6
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,91 @@
+#
+# General backup conventions and definitions according to
+# http://padrao.sarava.org/trac/wiki/Backups/Convencoes
+#
+# This module is distributed under the GNU Affero General Public License:
+#
+# Backup module for puppet
+# Copyright (C) 2009 Sarava Group
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# for data that's going to be encrypted and signed
+$backup_include_unencrypted = [ "/etc", "/var", "/home", ]
+$backup_exclude_unencrypted = [ "/var/backups/remote", "/var/vservers", "/var/backups/duplicity" ]
+
+# for data that were previously encrypted and signed
+$backup_include_encrypted = [ "/var/backups/duplicity", ]
+$backup_exclude_encrypted = [ "/var/backups/duplicity/.ssh", ]
+
+class backup {
+
+ package { "rdiff-backup": ensure => installed, }
+ package { "debconf-utils": ensure => installed, }
+
+ backupninja::config { "conf":
+ loglvl => 4,
+ usecolors => false,
+ }
+
+ # default backupninja::rdiff configuration
+ define rdiff($port = '22', $ensure = present, $installkey = false) {
+ backupninja::rdiff { "rdiff-$title.$domain":
+ ensure => $ensure,
+ options => "--remote-schema 'ssh -p $port -C %s rdiff-backup --server'",
+ # [source]
+ keep => "10",
+ include => $backup_include_encrypted,
+ exclude => $backup_exclude_encrypted,
+ # [dest]
+ type => "remote",
+ host => "$title.$domain",
+ directory => "/var/backups/remote/$fqdn/rdiff",
+ user => "$hostname",
+ sshoptions => "-p $port",
+ installkey => $installkey,
+ }
+ }
+
+ # local backups using duplicity
+ define duplicity($encryptkey = false,
+ $password = false,
+ $order = 50,
+ $ensure = present,
+ $full_if_older_than = "1M",
+ $remove_older_than = "45D",
+ $directory = "/var/backups/duplicity") {
+
+ case $encryptkey { false: { err("need to define a key!") } }
+ case $password { false: { err("need to define password!") } }
+
+ include backupninja::client
+
+ # backup dest folder
+ file { "/var/backups/duplicity":
+ ensure => directory,
+ owner => "root",
+ group => "root",
+ }
+
+ # the backupninja rule for this duplicity backup
+ file { "${backupninja::client::configdir}/${order}_duplicity-${title}.sh":
+ ensure => $ensure,
+ content => template('backup/dup.conf.erb'),
+ owner => root,
+ group => root,
+ mode => 0600,
+ require => File["${backupninja::client::configdir}"]
+ }
+ }
+}