forked from riseuplabs/puppet-backupninja
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a tar handler modeled after the rdiff handler
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# == Class: backupninja::client::tar | ||
# | ||
# Manage tar installation | ||
class backupninja::client::tar inherits backupninja::client::defaults { | ||
if !defined(Package['tar']) { | ||
if $tar_ensure_version == '' { | ||
$tar_ensure_version = 'installed' | ||
} | ||
package { 'tar': | ||
ensure => $tar_ensure_version, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Run tar as part of a backupninja run. | ||
# | ||
# Valid attributes for this type are: | ||
# | ||
# 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). | ||
# | ||
# include, exclude, compress, dateformat: 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::tar ( | ||
$order = 90, | ||
$ensure = present, | ||
$when = "everyday at 01:00", | ||
$backupname = "${fqdn}", | ||
$backupdir = '/var/backups', | ||
$compress = "bzip", | ||
$dateformat = "%Y.%m.%d-%H%M", | ||
$exclude = [ | ||
$directory, | ||
'/home/*/.gnupg', | ||
'/home/*/.local/share/Trash', | ||
'/home/*/.Trash', | ||
'/home/*/.thumbnails', | ||
'/home/*/.beagle', | ||
'/home/*/.aMule', | ||
'/home/*/gtk-gnutella-downloads', | ||
'/tmp', | ||
'/proc', | ||
'/dev', | ||
'/sys', | ||
'/net', | ||
'/misc', | ||
'/media', | ||
'/srv', | ||
'/selinux', | ||
], | ||
$include = [ | ||
'/etc', | ||
'/home', | ||
'/usr/local', | ||
], | ||
|
||
) { | ||
include ::backupninja::client::tar | ||
file { "${backupninja::client::defaults::configdir}/${order}_${name}.tar": | ||
ensure => $ensure, | ||
content => template('backupninja/tar.conf.erb'), | ||
owner => root, | ||
group => root, | ||
mode => '0600', | ||
require => File[$backupninja::client::defaults::configdir], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# This configuration file was auto-generated by the Puppet configuration | ||
# management system. Any changes you make to this file will be overwritten | ||
# the next time Puppet runs. Please make configuration changes to this | ||
# service in Puppet. | ||
|
||
<%= 'when = ' + @when if @when %> | ||
<%= 'backupdir = ' + @backupdir if @backupdir %> | ||
<%= 'backupname = ' + @backupname if @backupname %> | ||
<%= 'compress = ' + @compress if @compress %> | ||
<% if @include.is_a? String -%> | ||
<%= 'includes = ' + @include %> | ||
<% elsif @include.is_a? Array -%> | ||
<%= 'includes = ' + @include.map { |i| "#{i}" }.join(" ") %> | ||
<% end -%> | ||
|
||
<% if @exclude.is_a? String -%> | ||
<%= 'excludes = ' + @exclude %> | ||
<% elsif @exclude.is_a? Array -%> | ||
<%= 'excludes = ' + @exclude.map { |i| "#{i}" }.join(" ") %> | ||
<% end -%> | ||
|
||
<%= 'DATEFORMAT = ' + @dateformat if $dateformat %> |