class bacula::client inherits bacula {
+ @@bacula::storage-per-node { $::fqdn: }
package { ['bacula-fd']:
ensure => installed
include bacula
+ $bacula_pool_name = $bacula::bacula_pool_name
+ $bacula_filestor_name = $bacula::bacula_filestor_name
+ $bacula_filestor_device = $bacula::bacula_filestor_device
+ $bacula_storage_address = $bacula::bacula_storage_address
+ $bacula_storage_port = $bacula::bacula_storage_port
+ $bacula_storage_secret = $bacula::bacula_storage_secret
+
$bacula_client_port = $bacula::bacula_client_port
$bacula_ca_path = $bacula::bacula_ca_path
$bacula_ssl_client_cert = $bacula::bacula_ssl_client_cert
--- /dev/null
+define bacula::storage-per-node() {
+
+ include bacula
+
+ $bacula_filestor_device = $bacula::bacula_filestor_device
+ $bacula_filestor_name = $bacula::bacula_filestor_name
+ $bacula_backup_path = $bacula::bacula_backup_path
+
+ $bacula_client_name = "${name}-fd"
+ $client = $name
+
+ file {
+ "/etc/bacula/storage-conf.d/${name}.conf":
+ content => template('bacula/storage-per-client.conf.erb'),
+ mode => '0440',
+ group => bacula,
+ notify => Exec['bacula-sd reload'],
+ ;
+ "${bacula_backup_path}/${name}":
+ ensure => directory,
+ mode => '0755',
+ owner => bacula,
+ group => bacula,
+ ;
+ }
+}
+
enable => true,
hasstatus => true,
}
+
+ # should wait on -sd to finish current backups, then restart
+ # since it does not support reload and restarting kills running
+ # jobs
+ exec { 'bacula-sd reload':
+ path => '/usr/bin:/usr/sbin:/bin:/sbin',
+ command => 'true',
+ refreshonly => true,
+ }
+
file { '/etc/bacula/bacula-sd.conf':
content => template('bacula/bacula-sd.conf.erb'),
mode => '0640',
notify => Service['bacula-sd']
}
+ file { '/etc/bacula/storage-conf.d':
+ ensure => directory,
+ mode => '0755',
+ group => bacula,
+ purge => true,
+ force => true,
+ recurse => true,
+ source => 'puppet:///files/empty/',
+ notify => Exec['bacula-sd reload']
+ }
+
@ferm::rule { 'dsa-bacula-sd-v4':
domain => '(ip)',
description => 'Allow bacula-sd access from director and clients',
rule => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V6) ACCEPT; }',
notarule => true,
}
+
+ file { '/etc/bacula/storage-conf.d/empty.conf':
+ content => '',
+ mode => '0440',
+ group => bacula,
+ notify => Exec['bacula-sd reload']
+ }
+
+ Bacula::Storage-per-Node<<| |>>
+
}
append = "/var/lib/bacula/log" = all, !skipped
}
-########################################################################
-# Storage config #
-########################################################################
-
-Storage {
- Name = <%= bacula_filestor_name %>
- Address = <%= bacula_storage_address %>
- SDPort = <%= bacula_storage_port %>
- Password = "<%= bacula_storage_secret %>"
- Device = <%= bacula_filestor_device %>
- Media Type = <%= bacula_filestor_name %>
- Maximum Concurrent Jobs = 10
-
- TLS Enable = yes
- TLS Require = yes
- TLS CA Certificate File = "<%= bacula_ca_path %>"
- # This is a client certificate, used by the director to connect to the storage daemon
- TLS Certificate = "<%= bacula_ssl_client_cert %>"
- TLS Key = "<%= bacula_ssl_client_key %>"
-}
-
########################################################################
# Console, limited #
########################################################################
FileSet = "Standard Set"
Schedule = "WeeklyCycle"
Messages = Standard
- Pool = <%=bacula_pool_name%>
- Differential Backup Pool = <%=bacula_pool_name%>diff
- Incremental Backup Pool = <%=bacula_pool_name%>inc
Max Full Interval = 1 month
Priority = 10
Write Bootstrap = "/var/lib/bacula/%c.bsr"
Job {
Name = "RestoreFiles"
Type = Restore
- Client = draghi.debian.org-fd
+ Client = <%=bacula_director_address%>-fd
FileSet = "Standard Set"
- Pool = <%=bacula_pool_name%>
+ Pool = full-<%=bacula_pool_name%>-<%=bacula_director_address%>
Messages = Standard
Where = /var/tmp/bacula-restores
}
-########################################################################
-# Pool definition #
-########################################################################
-Pool {
- Name = <%= bacula_pool_name %>
- Pool Type = Backup
- Storage = <%=bacula_filestor_name%>
- Recycle = no
- AutoPrune = yes
- Volume Retention = 1 year
- Label Format = "<%= bacula_pool_name %>.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
- Volume Use Duration = 23h
- #Maximum Volume Jobs = 1
- Maximum Volume Bytes = 50G
- Action On Purge = Truncate
-}
-
-Pool {
- Name = <%= bacula_pool_name %>diff
- Pool Type = Backup
- Storage = <%=bacula_filestor_name%>
- Recycle = no
- AutoPrune = yes
- Volume Retention = 1 year
- Label Format = "<%= bacula_pool_name %>diff.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
- Volume Use Duration = 23h
- #Maximum Volume Jobs = 1
- Maximum Volume Bytes = 50G
- Action On Purge = Truncate
-}
-
-Pool {
- Name = <%= bacula_pool_name %>inc
- Pool Type = Backup
- Storage = <%=bacula_filestor_name%>
- Recycle = no
- AutoPrune = yes
- Volume Retention = 1 year
- Label Format = "<%= bacula_pool_name %>inc.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
- Volume Use Duration = 23h
- #Maximum Volume Jobs = 1
- Maximum Volume Bytes = 50G
- Action On Purge = Truncate
-}
# Scratch pool definition
Pool {
Name = Standard
director = <%= bacula_director_name %> = all
}
+@|"sh -c 'for f in /etc/bacula/storage-conf.d/*.conf ; do echo @${f} ; done'"
JobDefs = "Standardbackup"
Client = <%= bacula_client_name %>
+ Pool = "poolfull-<%= bacula_pool_name %>-<%= client %>"
+ Differential Backup Pool = "pooldiff-<%= bacula_pool_name %>-<%= client %>"
+ Incremental Backup Pool = "poolinc-<%= bacula_pool_name %>-<%= client %>"
+
#Rerun Failed Levels = yes
Reschedule On Error = yes
Reschedule Interval = 4 hours
TLS Certificate = "<%= bacula_ssl_client_cert %>"
TLS Key = "<%= bacula_ssl_client_key %>"
}
+
+########################################################################
+# Storage config #
+########################################################################
+
+Storage {
+ Name = "<%= bacula_filestor_name %>-<%= client %>"
+ Address = <%= bacula_storage_address %>
+ SDPort = <%= bacula_storage_port %>
+ Password = "<%= bacula_storage_secret %>"
+ Device = "<%= bacula_filestor_device %>-<%= client %>"
+ Media Type = "<%= bacula_filestor_name %>-<%= client %>"
+ Maximum Concurrent Jobs = 10
+
+ TLS Enable = yes
+ TLS Require = yes
+ TLS CA Certificate File = "<%= bacula_ca_path %>"
+ # This is a client certificate, used by the director to connect to the storage daemon
+ TLS Certificate = "<%= bacula_ssl_client_cert %>"
+ TLS Key = "<%= bacula_ssl_client_key %>"
+}
+
+########################################################################
+# Pool definition #
+########################################################################
+Pool {
+ Name = "poolfull-<%=bacula_pool_name%>-<%= client %>"
+ Pool Type = Backup
+ Storage = "<%=bacula_filestor_name%>-<%= client %>"
+ Recycle = no
+ AutoPrune = yes
+ Volume Retention = 1 year
+ Label Format = "<%= bacula_pool_name %>-full-<%= client %>.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
+ Volume Use Duration = 23h
+ Maximum Volume Jobs = 1
+ Maximum Volume Bytes = 50G
+ Action On Purge = Truncate
+}
+
+Pool {
+ Name = "pooldiff-<%=bacula_pool_name%>-<%= client %>"
+ Pool Type = Backup
+ Storage = "<%=bacula_filestor_name%>-<%= client %>"
+ Recycle = no
+ AutoPrune = yes
+ Volume Retention = 1 year
+ Label Format = "<%= bacula_pool_name %>-diff-<%= client %>.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
+ Volume Use Duration = 23h
+ Maximum Volume Jobs = 1
+ Maximum Volume Bytes = 50G
+ Action On Purge = Truncate
+}
+
+Pool {
+ Name = "poolinc-<%=bacula_pool_name%>-<%= client %>"
+ Pool Type = Backup
+ Storage = "<%=bacula_filestor_name%>-<%= client %>"
+ Recycle = no
+ AutoPrune = yes
+ Volume Retention = 2 months
+ Label Format = "<%= bacula_pool_name %>-inc-<%= client %>.${Year}-${Month:p/2/0/r}-${Day:p/2/0/r}_${Hour:p/2/0/r}:${Minute:p/2/0/r}"
+ Volume Use Duration = 23h
+ Maximum Volume Jobs = 1
+ Maximum Volume Bytes = 50G
+ Action On Purge = Truncate
+}
--- /dev/null
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+Device {
+ Name = "<%= bacula_filestor_device %>-<%= client %>"
+ Media Type = "<%= bacula_filestor_name %>-<%= client %>"
+ Archive Device = "<%= bacula_backup_path %>/<%= client %>"
+ LabelMedia = yes;
+ Random Access = Yes;
+ AutomaticMount = yes;
+ RemovableMedia = no;
+ AlwaysOpen = no;
+ Maximum Network Buffer Size = 524288
+}