A puppet module for the Bacula backup system.
- OpenBSD
- FreeBSD
- Linux (Debian, Ubuntu, RedHat, Centos, 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.
Bacula's functionality depends on connecting several components. Due to the numebr of moving pieces in this module, you will likely want to set some site defaults, and tune more specifically where desired.
As such, it is reasonable to set the following hiera data that will allow many of the classes in this module to use those defaults sanely.
bacula::params::storage: 'mydirector.example.com'
bacula::params::director: 'mydirector.example.com'
This may be on the same host, or different hosts, but the name you put here
should be the fqdn of the target system. The Director will require the
classification of bacula::director
, and the Storage node will require the
classification of bacula::storage
. All nodes will require classification of
bacula::client
.
Several params have been removed and replaced with the default names. Update your hiera data and parameters as follows.
The following have been replaced with simply bacula::params::director
.
bacula::params::director_name
bacula::params::bacula_director
The following have been replaced with simply bacula::params::storage
.
bacula::params::bacula_storage
bacula::params::storage_name
The default 'Full' and 'Inc' pools no longer get created. Only the pool
called 'Default' is created. As such, the following parameter have been
removed from the bacula::storage
class.
$volret_full
$volret_incremental
$maxvolbytes_full
$maxvoljobs_full
$maxvols_full
$maxvolbytes_incremental
$maxvoljobs_incremental
$maxvols_incremental
This now means that Full jobs are not directed to a 'Full' pool, and Incremental jobs are no longer directed to an 'Inc' pool.
To gain the same functionality available in previous versions using a default pool for a specific level of backup, create a pool as directed below, and set any of the following parameters for your clients.
bacula::client::default_pool_full
bacula::client::default_pool_inc
bacula::client::default_pool_diff
The value of these parameters should be set to the resource name of the pool.
To enable SSL for the communication between the various components of Bacula, the hiera data for SSL must be set.
bacula::params::ssl: true
This will ensure that SSL values are processed in the various templates that
are capable of SSL communication. An item of note: this module expects to be
using the SSL directory for Puppet. The default value for the Puppet SSL
directory this module will use is /etc/puppetlabs/puppet/ssl
to support the
future unified Puppet deployment.
To change the SSL directory, simply set bacula::params::ssl_dir
. For
example, to use another module for the data source of which SSL directory to
use for Puppet, something like the following is in order.
bacula::params::ssl_dir: "%{scope('puppet::params::puppet_ssldir')}"
This example assumes that you are using the ploperations/puppet module, but
this has been removed as a dependency. Users may also wish to look at
theforeman/puppet or just set it to the location known to house your ssl
data, like /etc/puppetlabs/puppet/ssl
.
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
parameter here defines which storage server should be used for
all default jobs. If left empty, it will default to the $::fqdn
of the
director. This is not a problem for all in one installations, but in
scenarios where directors to not have the necessary storage devices attached,
default jobs can be pointed elsewhere.
Note that if you expect an SD to be located on the Director, you will
also need to include the bacula::storage
class as follows.
By default a 'Common' fileset is created.
The storage component allocates disk storage for pools that can be used for holding backup data.
class { 'bacula::storage': director => 'mydirector.example.com' }
You will also want a storage pool that defines the retention. You can define this in the Director catalog without exporting it, or you can use an exported resource.
bacula::director::pool { 'Corp':
volret => '14 days',
maxvolbytes => '5g',
maxvols => '200',
label => 'Corp-',
storage => 'mystorage.example.com',
}
The client component is run on each system that needs something backed up.
class { 'bacula::client': director => 'mydirector.example.com' }
To direct all jobs to a specific pool like the one defined above set the following data.
bacula::client::default_pool: 'Corp'
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
exports a job
definition to the director.
bacula::job { 'obsidian_logs':
files => ['/var/log'],
}
This resource 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. BaculaFile
directive.excludes
: string or array of files to exclude from a backup. Defaults to''
. BaculaExclude
directive.options
: hash of options. Defaults to{'signature' => 'MD5', 'compression' => 'GZIP'}
. BaculaOptions
directive.
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
,Admin
orVerify
. Defaults toBackup
. BaculaType
directive.fileset
: determines whether to use theCommon
fileset (false
), define a newBacula::Fileset[$name]
(true
) or use a previously definedBacula::Fileset
resource (any other string value). Defaults totrue
. BaculaFileSet
directive.template
: template to use for the fragment. Defaults tobacula/job.conf.erb
.pool
: name of thebacula::director::pool
to use. Defaults tobacula::client::default_pool
. BaculaPool
directive.pool_full
: name of the pool to be used for 'Full' jobs. Defaults tobacula::client::default_pool_full
. BaculaFull Backup Pool
directive.pool_inc
: name of the pool to be used for 'Incremental' jobs. Defaults tobacula::client::default_pool_inc
. BaculaIncremental Backup Pool
directive.pool_diff
: name of the pool to be used for 'Incremental' jobs. Defaults tobacula::client::default_pool_diff
. BaculaDifferential Backup Pool
directive.jobdef
: name of thebacula::jobdef
to use. Defaults toDefault
. BaculaJobDefs
directive.level
: default job level to run the job as. BaculaLevel
directive.accurate
: whether to enable accurate mode. NB, can be memory intensive on the client. Defaults to 'no'. Bacula 'Accurate' directive.messages
: the name of the message resource to use for this job. Defaults tofalse
which disables this directive. BaculaMessages
directive. To ensure compatibility with existing installations, the BaculaMessages
directive is set toStandard
whenJobtype
isRestore
and themessages
parameter isfalse
.restoredir
: the prefix for restore jobs. Defaults to/tmp/bacula-restores
. BaculaWhere
directive.sched
: the name of the scheduler resource to use for this job. Defaults tofalse
which disables this directive. BaculaSchedule
directive.priority
: the priority of the job. Defaults tofalse
which disables this directive. BaculaPriority
directive.
See also bacula::jobdefs
.
Define a Bacula JobDefs resource resource. Parameters are:
jobtype
: one ofBackup
,Restore
,Admin
orVerify
. Defaults toBackup
. BaculaType
directive.sched
: name of thebacula::schedule
to use. Defaults toDefault
. BaculaSchedule
directive.messages
: which messages resource to deliver to. Defaults toStandard
. BaculaMessages
directive.priority
: priority of the job. Defaults to10
. BaculaPriority
directive.pool
: name of thebacula::director::pool
to use. Defaults toDefault
. BaculaPool
directive.level
: default job level for jobs using this JobDefs. BaculaLevel
directive.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 Error
directive.reschedule_interval
: The time between retries for failed jobs. BaculaReschedule Interval
directive.reschedule_times
: The number of retries for failed jobs. BaculaReschedule Times
directive.
Define a Bacula Messages resource. Parameters are:
mname
: name of theMessages
resource. Defaults toStandard
. BaculaName
directive.daemon
: Defaults todir
.director
: BaculaDirector
directive. Note this is not just the name of a director, but director string as found in the documentation for Messages resource under the director option. The message type must be included with the proper formatting.append
: BaculaAppend
directive.Catalog
: BaculaCatalog
directive.syslog
: BaculaSyslog
directive.Console
: BaculaConsole
directive.mail
: BaculaMail
directive.Operator
: BaculaOperator
directive.mailcmd
: BaculaMail Command
directive.operatorcmd
: BaculaOperator Command
directive.
Define a Bacula Schedule resource. Parameter is:
runs
: define when a job is run. BaculaRun
directive.
Define a Bacula Pool resource. Parameters are:
pooltype
: Defaults toBackup
. BaculaPool Type
directive.recycle
BaculaRecycle
directive.autoprune
: Defaults toYes
. BaculaAutoPrune
directive.volret
: BaculaVolume Retention
directive.maxvols
: BaculaMaximum Volumes
directive.maxvoljobs
: BaculaMaximum Volume Jobs
directive.maxvolbytes
: BaculaMaximum Volume Bytes
directive.purgeaction
: BaculaAction On Purge
directive. Defaults toTruncate
.label
: BaculaLabel Format
directive.voluseduration
: BaculaVolume Use Duration
directive.storage
: name of theStorage
resource backing the pool. Defaults to$bacula::params::storage
. BaculaStorage
directive.