A puppet module for the Bacula backup system.
- OpenBSD
- FreeBSD
- Linux (Debian, Ubuntu, Centos, RedHat, Fedora, SLES)
This module requires that exported resources have been setup (e.g. with PuppetDB)
To understand Bacula, the Component Overview in the Bacula documentation is a useful start to begin understanding the moving parts.
What follows here is the bare minimum you would need to get a fully functional Bacula environment with Puppet. This setup assumes that the three components of Bacula (Director, Storage, and Client) all run on three separate nodes. If desired, there is no reason this setup can not be build up on a single node, just updating the hostnames used below to all point to the same system.
The director component handles coordination of backups and databasing of transactions. In its simplest form, the director can be configured with a simple declaration:
class { 'bacula::director': storage => 'mystorage.example.com' }The storage component allocates disk storage for pools that can be used for holding backup data.
class { 'bacula::storage': director => 'mydirector.example.com' }The client component is run on each system that needs something backed up.
class { 'bacula::client': director => 'mydirector.example.com' }In order for clients to be able to define jobs on the director, exported
resources are used, thus there was a reliance on PuppetDB availability in the
environment. In the client manifest the bacula::job can be declared as
follows:
bacula::job { 'obsidian_logs':
files => ['/var/log'],
}Will create a new Job entry in /etc/bacula/conf.d/job.conf the next time
the director applies it's catalog that will instruct the system to backup the
files or directories at the paths specified in the files parameter.
If a group of jobs will contain the same files, a FileSet resource can be
used to simplify the bacula::job resource. This can be exported from the
node (ensuring the resource title will be unique when realized) or a simple
resource specified on the director using the bacula::fileset defined type as
follows:
bacula::fileset { 'Puppet':
files => ['/etc/puppet'],
options => {'compression' => 'LZO' }
}Defines a Bacula FileSet resource. Parameters are:
files: string or array of files to backup. BaculaFiledirective.excludes: string or array of files to exclude from a backup. Defaults to''. BaculaExcludedirective.options: hash of options. Defaults to{'signature' => 'MD5', 'compression' => 'GZIP'}. BaculaOptionsdirective.
Define a Bacula Job resource resource which can create new Bacula::Fileset
resources if needed. Parameters are:
files: array of files to backup as part ofBacula::Fileset[$name]Defaults to[].excludes: array of files to exclude inBacula::Fileset[$name]Defaults to[].jobtype: one ofBackup(default),Restore,AdminorVerify. Defaults toBackup. BaculaTypedirective.fileset: determines whether to use theCommonfileset (false), define a newBacula::Fileset[$name](true) or use a previously definedBacula::Filesetresource (any other string value). Defaults totrue. BaculaFileSetdirective.template: template to use for the fragment. Defaults tobacula/job.conf.erb.pool: name of thebacula::director::poolto use. Defaults toDefault. BaculaPooldirective.jobdef: name of thebacula::jobdefto use. Defaults toDefault. BaculaJobDefsdirective.level: default job level to run the job as. BaculaLeveldirective.accurate: whether to enable accurate mode. NB, can be memory intensive on the client. Defaults to 'no'. Bacula 'Accurate' directive.
See also bacula::jobdefs.
Define a Bacula JobDefs resource resource. Parameters are:
jobtype: one ofBackup,Restore,AdminorVerify. Defaults toBackup. BaculaTypedirective.sched: name of thebacula::scheduleto use. Defaults toDefault. BaculaScheduledirective.messages: which messages resource to deliver to. Defaults toStandard. BaculaMessagesdirective.priority: priority of the job. Defaults to10. BaculaPrioritydirective.pool: name of thebacula::director::poolto use. Defaults toDefault. BaculaPooldirective.level: default job level for jobs using this JobDefs. BaculaLeveldirective.accurate: whether to enable accurate mode. NB, can be memory intensive on the client. Defaults to 'no'. Bacula 'Accurate' directive.reschedule_on_error: Enable rescheduling of failed jobs. Default: false. BaculaReschedule On Errordirective.reschedule_interval: The time between retries for failed jobs. BaculaReschedule Intervaldirective.reschedule_times: The number of retries for failed jobs. BaculaReschedule Timesdirective.
Define a Bacula Messages resource. Parameters are:
mname: name of theMessagesresource. Defaults toStandard. BaculaNamedirective.daemon: Defaults todir.director: BaculaDirectordirective.append: BaculaAppenddirective.Catalog: BaculaCatalogdirective.syslog: BaculaSyslogdirective.Console: BaculaConsoledirective.mail: BaculaMaildirective.Operator: BaculaOperatordirective.mailcmd: BaculaMail Commanddirective.operatorcmd: BaculaOperator Commanddirective.
Define a Bacula Schedule resource. Parameter is:
runs: define when a job is run. BaculaRundirective.
Define a Bacula Pool resource. Parameters are:
pooltype: Defaults toBackup. BaculaPool Typedirective.recycleBaculaRecycledirective.autoprune: Defaults toYes. BaculaAutoPrunedirective.volret: BaculaVolume Retentiondirective.maxvoljobs: BaculaMaximum Volume Jobsdirective.maxvolbytes: BaculaMaximum Volume Bytesdirective.purgeaction: BaculaAction On Purgedirective. Defaults toTruncate.label: BaculaLabel Formatdirective.storage: name of theStorageresource backing the pool. Defaults to$bacula::params::bacula_storage. BaculaStoragedirective.