README 4.87 KB
Newer Older
Micah Anderson's avatar
Micah Anderson committed
1 2 3
Backupninja Module
-------------------

4 5
This module helps you configure all of your backups with puppet, using 
backupninja!
Micah Anderson's avatar
Micah Anderson committed
6

7
! Upgrade notice !
Micah Anderson's avatar
Micah Anderson committed
8

9 10 11 12
If you were previously using this module, some pieces have changed,
and you need to carefully change your use of them, or you will find
your backups to be duplicated on your backup server. The important
part that changed has to do with the rdiff-backup handler, if you
anarcat's avatar
anarcat committed
13
weren't using that, you don't need to worry.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

If you were, you will need to make sure you change all of your
"$directory" parameters to be "$home" instead, and on your
backupserver you will need to move all of your backups into
"$home"/rdiff-backup. Previously, they were put in "$directory", which
doubled as the home for the user that was created. This caused
problems with rdiff-backup because of dot files and other things which
were not part of any rdiff-backup.

Getting started
---------------

First you will need to import the module:

  import "backupninja"

Configure your backup server
----------------------------

Now you will need to configure a backup server by adding the following
to your node definition for that server:
  
  include backupninja::server

By configuring a backupninja::server, this module will automatically
create sandboxed users on the server for each client for their
backups. 
Micah Anderson's avatar
Micah Anderson committed
41

42 43 44 45 46 47 48 49
You may also want to set some variables on your backup server, such as:

  $backupdir = "/backups"


Configure your backup clients
-----------------------------

50 51 52
The backupninja package and the necessary backup software will be
installed automatically when you include any of the different handlers
(as long as you are not handling it elsewhere in your manifests), for
53
example:
54

55 56 57 58 59 60 61 62 63 64
include backupninja::client::rdiff_backup

In this case, the module will make sure that the backupninja package
and the required rdiff-backup package are 'installed'/'present' (using
puppet's ensure parameter language). If you need to specify a specific
version of either backupninja itself, or the specific programs that
the handler class installs, you can specify the version you need
installed by providing a variable, for example:

$backupninja_ensure_version = "0.9.7~bpo50+1"
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
$rdiff_backup_ensure_version = "1.2.5-1~bpo40+1"
$rsync_ensure_version = "3.0.6-1~bpo50+1"
$duplicity_ensure_version = "0.6.04-1~bpo50+1"
$debconf_utils_ensure_version = "1.5.28"
$hwinfo_ensure_version = "16.0-2"

If you do not specify these variables the default 'installed/present'
version will be installed when you include this class.

Configuring handlers
--------------------

Depending on which backup method you want to use on your client, you
can simply specify some configuration options for that handler that are
necessary for your client.

Each handler has its own configuration options necessary to make it
work, each of those are available as puppet parameters. You can see
the handler documentation, or look at the handler puppet files
included in this module to see your different options.

Included below are some configuration examples for different handlers.

* An example mysql handler configuration:
Micah Anderson's avatar
Micah Anderson committed
89 90 91 92 93 94 95 96

backupninja::mysql { all_databases:
	user => root,
	backupdir => '/var/backups',
	compress => true,
	sqldump => true
}

97 98
* An example rdiff-backup handler configuration:

Micah Anderson's avatar
Micah Anderson committed
99 100 101 102 103 104
backupninja::rdiff { backup_all:
	directory => '/media/backupdisk',
	include => ['/var/backups', '/home', '/var/lib/dpkg/status'],
	exclude => '/home/*/.gnupg'
}

105
* A remote rdiff-backup handler:
106 107 108 109 110 111 112 113

    backupninja::rdiff { "main":
        host => "backup.example.com",
        type => "remote",
        directory => "/backup/$fqdn",
        user => "backup-$hostname",
    }

114

115 116
Configuring backupninja itself
------------------------------
117

118 119 120 121
You may wish to configure backupninja itself. You can do that by doing
the following, and the /etc/backupninja.conf will be managed by
puppet, all the backupninja configuration options are available, you
can find them inside this module as well.
122

123
For example:
124

125 126 127 128 129 130
backupninja::config { conf:
	loglvl => 3,
	usecolors => false,
	reportsuccess => false,
	reportwarning => true;
}
131

132 133 134 135

Nagios alerts about backup freshness
------------------------------------

136 137 138 139 140
If you set the $nagios_server variable to be the name of your nagios
server, then a passive nagios service gets setup so that the backup
server pushes checks, via a cronjob that calls
/usr/local/bin/checkbackups.pl, to the nagios server to alert about
relative backup freshness.
141

142 143 144 145 146
To use this feature a few pre-requisites are necessary:

 . configure nsca on your backup server (not done via puppet yet)
 . configure nsca on your nagios server (not done via puppet yet)
 . server backup directories are named after their $fqdn
147
 . using nagios2 module, nagios/nagios3 modules/nativetypes not supported yet
148
 . using a nagios puppet module that can create passive service checks
149
 . backups must be under $home/dup, $home/rdiff-backup depending on method
150 151 152
 . $nagios_server must be set before the class is included