cookbook 'bacula-backup', '= 1.8.1'
bacula-backup (9) Versions 1.8.1 Follow1
Installs and autoconfigures bacula backup system
cookbook 'bacula-backup', '= 1.8.1', :supermarket
knife supermarket install bacula-backup
knife supermarket download bacula-backup
Description
NOTE: This cookbook is forked from the awesome work done by computerlyrik to add additional features (e.g. tape drive support). Its name has been changed to bacula-backup
to allow for a unique cookbook name to be used on the Supermarket. It may be renamed to just bacula
again in the future.
Tested on Ubuntu 12.04 server (should also work on Debian - please report!). Also supports file daemon (e.g. 'client') installs on RHEL 5 & Windows.
Supports File backup on a dedicated storage server with a single bacula director and multiple clients to be backed up.
Painlessly autoconfigures itself and the Jobs to be done.
Backs up daily incremental, full weekly. (see usage)
Also supports installation of bacula console to observe your backup progresses.
Autogenerated Jobs
- Files
- LDAP
- Chef server
Recipes
Bacula Director (bacula-dir)
bacula-backup::server
Central backup server
Bacula File Daemon (bacula-fd)
bacula-backup::client
Used by each client to be backed up. Currently supports Ubuntu 12.04/14.04, RHEL/CentOS 5, and MS Windows.
Bacula Storage Daemon (bacula-sd)
bacula-backup::storage (bacula-sd)
For use on storage system
Bacula Administration Tool BAT (bacula-console-qt)
bacula-backup::bat
Used for Systems with graphic environment - installs and configures "bat" Bacula qt-console
Requirements
See metadata for cookbook dependencies.
Attributes
default.rb
Configure the bacula user
ruby
node['bacula']['user']
node['bacula']['group']
server.rb
Set general backup properties
ruby
node['bacula']['dir']['max_concurrent_jobs'] = "1"
node['bacula']['dir']['address'] = nil # if set, causes to director to bind to the specified address
Set properties for File based backup
ruby
node['bacula']['volume_size'] = "1G"
node['bacula']['volume_max'] = 20
node['bacula']['label_format'] = "BaculaFile"
Additional storage pools (beyond the built-in File & Default pools) can be specified as arrays in the ['bacula']['dir']['pools']
attribute. E.g.:
ruby
default['bacula']['dir']['pools'] = [
{
"Name": "MyTapePool",
"Volume Retention": "365 days",
"Storage": "\"mystorage.local-mytapelibrary-LTO-5\"",
"Pool Type": "Backup",
"RecyclePool": "Scratch",
"Recycle Oldest Volume": "yes"
}
]
The contents of this array will be directly converted into Pool
resources in the storage configuration file. E.g., the above example would be translated to:
Pool {
Name = MyTapePool
Volume Retention = 365 days
Storage = "mystorage.local-mytapelibrary-LTO-5"
Pool Type = Backup
RecyclePool = Scratch
Recycle Oldest Volume = yes
}
client.rb
Set files to be backed up (see Usage below)
ruby
node['bacula']['fd']['files']
storage.rb
Set up destination of File-Storage
ruby
default['bacula']['sd']['backup_dir'] = "/backup"
Configures the Maximum Network Buffer Size for the File-Storage device
ruby
default['bacula']['sd']['file_max_net_buffer'] = "32768"
Additional storage devices (e.g. tape devices and autochangers) can be specified in the ['bacula']['sd']['devices']
or ['bacula']['sd']['autochangers']
attributes (and then again in ['bacula']['sd']['dir-devices']
-- see below). E.g.:
ruby
default['bacula']['sd']['devices'] = [
{
"Name": "LTO5-1",
"Media Type": "LTO-5",
"RemovableMedia": "yes",
"RandomAccess": "no",
"Archive Device": "/dev/nst1"
}
]
The contents of these arrays will be directly converted into Device
or Autochanger
resources in the storage configuration file. E.g., the above example would be translated to:
Device {
Name = LTO5-1
Media Type = LTO-5
RemovableMedia = yes
RandomAccess = no
Archive Device = /dev/nst1
}
Because options for the corresponding director Storage
resources can vary (e.g., are devices in an autochanger? If yes, don't make their own Storage resource), these need to be manually specified. E.g.:
ruby
default['bacula']['sd']['dir-devices'] = [
{
"Device": "mytapelibrary",
"Media Type": "LTO-5",
"AllowCompression": "no",
"Autochanger": "yes"
}
]
Note that the Name
, Address
, SDPort
, and Password
attributes must be ommitted as they are automatically configured. The contents of this array will be directly converted into Storage
resources in the director configuration file. E.g., the above example would be translated to the following (assuming a server with a FQDN of mystorage.local, ip of 1.2.3.4, and password of 12345):
Storage {
Name = mystorage.local-mytapelibrary-LTO-5
Address = 1.2.3.4
SDPort = 9103
Password = "12345"
Device = mytapelibrary
Media Type = LTO-6
AllowCompression = no
Autochanger = yes
}
Usage
Backup Job generation
To autogenerate jobs the following expressions need to be true
on bacula-backup::client
machine:
Ldap
node['openldap'] && node['openldap']['slapd_type'] == "master"
Chef Server
node['fqdn'] == "chef.#{node['domain']}"
Default deployment
- node A => bacula-backup::server
- node B => bacula-backup::storage (with much storage)
- node C-Z => bacula-backup::client
Examples
Simple file backup
Set on your bacula-backup::client
node
ruby
node.set['bacula']['fd']['files'] = {
'includes' => ['/']],
'excludes' => [ '/dev','sys']
}
Custom Backups
When more granual control over backup jobs/filesets/schedules is needed, they can be specified as arrays on the clients' ['bacula']['fd']['jobs']
, ['bacula']['fd']['filesets']
, & ['bacula']['fd']['schedules']
attributes. E.g.:
"default_attributes": { "bacula": { "fd": { "filesets": [ [ "Name = \"myclient-accurate-opt\"", "Ignore FileSet Changes = yes", "Include {", " Options {", " signature = MD5", " }", "File = /opt", "}" ] ], "jobs": [ { "Name": "\"myclient-wednesdays\"", "Client": "myclient.local", "Type": "Backup", "Accurate": "yes", "Level": "Incremental", "Messages": "Standard", "FileSet": "\"myclient-accurate-opt\"", "Schedule": "\"myclient-wednesday\"", "Pool": "Default", "Storage": "File" } ], "schedules": [ [ "Name = \"myclient-wednesday\"", "Run = Level=Full 1st wed at 18:00", "Run = Level=Incremental 2nd wed at 18:00", "Run = Level=Incremental 3rd wed at 18:00", "Run = Level=Incremental 4th wed at 18:00", "Run = Level=Incremental 5th wed at 18:00" ] ] } } }
Note that schedules
and filesets
are specified as raw arrays under their parent array (because of their varied and often complex structure), and jobs
are specified are hashes under their parent array. The above example will generate the following director entries:
FileSet {
Name = "myclient-accurate-opt"
Ignore FileSet Changes = yes
Include {
Options {
signature = MD5
}
File = /opt
}
}
Job {
Name = "myclient-wednesdays"
Client = myclient.local
Type = Backup
Accurate = yes
Level = Incremental
Messages = Standard
FileSet = "myclient-accurate-opt"
Schedule = "myclient-wednesday"
Pool = Default
Storage = File
}
Schedule {
Name = "myclient-wednesday"
Run = Level=Full 1st wed at 18:00
Run = Level=Incremental 2nd wed at 18:00
Run = Level=Incremental 3rd wed at 18:00
Run = Level=Incremental 4th wed at 18:00
Run = Level=Incremental 5th wed at 18:00
}
Contact
see metadata.rb
Dependent cookbooks
database < 4.0 |
mysql ~> 5.5 |
mysql-chef_gem ~> 0.0.2 |
openssl >= 0.0.0 |
windows >= 0.0.0 |
Contingent cookbooks
There are no cookbooks that are contingent upon this one.
Foodcritic Metric
1.8.1 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/5ee6274598c70cdc4722c4d2/bacula-backup/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/5ee6274598c70cdc4722c4d2/bacula-backup/metadata.rb:1
1.8.1 failed this metric
FC045: Consider setting cookbook name in metadata: /tmp/cook/5ee6274598c70cdc4722c4d2/bacula-backup/metadata.rb:1