1 # the bacula storage node
3 # @param backup_path the directory where backups should be stored
4 # @param filestor_device Storage device name prefix
5 # @param filestor_name Storage device media type name prefix
6 # @param port_sd Port for the sd to listen on
7 class bacula::storage (
8 String $backup_path = '/srv/bacula',
9 String $filestor_device = 'FileStorage',
10 String $filestor_name = 'File',
11 Integer $port_sd = 9103,
13 $storage_secret = hkdf('/etc/puppet/secret', "bacula-sd-${::fqdn}")
15 package { 'bacula-sd':
19 service { 'bacula-sd':
24 dsa_systemd::override { 'bacula-sd':
28 SupplementaryGroups=ssl-cert
32 exec { 'bacula-sd restart-when-idle':
33 path => '/usr/bin:/usr/sbin:/bin:/sbin',
34 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_sd} bacula-sd &'",
36 subscribe => File[$bacula::bacula_ssl_server_cert],
37 require => File['/usr/local/sbin/bacula-idle-restart'],
41 file { '/etc/bacula/bacula-sd.conf':
42 content => template('bacula/bacula-sd.conf.erb'),
45 notify => Exec['bacula-sd restart-when-idle']
48 file { '/etc/bacula/storage-conf.d':
55 source => 'puppet:///files/empty/',
56 notify => Exec['bacula-sd restart-when-idle']
59 # allow access from director and fds
60 ferm::rule::simple { 'dsa-bacula-sd':
61 description => 'Access to the bacula-storage',
63 target => 'bacula-sd',
65 Ferm::Rule::Simple <<| tag == "bacula::director-to-storage::${bacula::bacula_director_address}" |>>;
66 Ferm::Rule::Simple <<| tag == "bacula::fd-to-storage::${::fqdn}" |>>;
68 file { '/etc/bacula/storage-conf.d/empty.conf':
72 notify => Exec['bacula-sd restart-when-idle']
75 package { 'python3-psycopg2': ensure => installed }
76 file { '/usr/local/bin/bacula-unlink-removed-volumes':
77 source => 'puppet:///modules/bacula/bacula-unlink-removed-volumes',
80 file { '/etc/cron.d/puppet-bacula-storage-stuff': ensure => absent, }
81 concat::fragment { 'puppet-crontab--bacula-storage':
82 target => '/etc/cron.d/puppet-crontab',
84 @daily bacula chronic /usr/local/bin/bacula-unlink-removed-volumes -v
88 Bacula::Storage::Client<<| tag == "bacula::to-storage::${::fqdn}" |>>