1 # the bacula storage node
3 # @param backup_path 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 # @param storage_name bacula name of this sd instance
8 # @param storage_address address of this sd instance that other instances should connect to (dns name)
9 # @param has_ipv4 SD should listen on ipv4
10 # @param has_ipv6 SD should listen on ipv6
11 class bacula::storage (
12 String $backup_path = '/srv/bacula',
13 String $filestor_device = 'FileStorage',
14 String $filestor_name = 'File',
15 Integer $port_sd = 9103,
16 String $storage_name = "${::fqdn}-sd",
17 Stdlib::Host $storage_address = $::fqdn,
18 Boolean $has_ipv4 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V4 },
19 Boolean $has_ipv6 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V6 },
22 package { 'bacula-sd':
26 service { 'bacula-sd':
31 dsa_systemd::override { 'bacula-sd':
35 SupplementaryGroups=ssl-cert
39 exec { 'bacula-sd restart-when-idle':
40 path => '/usr/bin:/usr/sbin:/bin:/sbin',
41 command => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_sd} bacula-sd &'",
43 subscribe => File[$bacula::bacula_ssl_server_cert],
44 require => File['/usr/local/sbin/bacula-idle-restart'],
48 file { '/etc/bacula/bacula-sd.conf':
49 content => template('bacula/bacula-sd.conf.erb'),
52 notify => Exec['bacula-sd restart-when-idle']
55 file { '/etc/bacula/storage-conf.d':
62 notify => Exec['bacula-sd restart-when-idle']
65 # allow access from director and fds
66 ferm::rule::simple { 'dsa-bacula-sd':
67 description => 'Access to the bacula-storage',
69 target => 'bacula-sd',
71 Ferm::Rule::Simple <<| tag == 'bacula::director-to-storage' |>>;
72 Ferm::Rule::Simple <<| tag == "bacula::fd-to-storage::${::fqdn}" |>>;
74 file { '/etc/bacula/storage-conf.d/empty.conf':
78 notify => Exec['bacula-sd restart-when-idle']
81 package { 'python3-psycopg2': ensure => installed }
82 file { '/usr/local/bin/bacula-unlink-removed-volumes':
83 source => 'puppet:///modules/bacula/bacula-unlink-removed-volumes',
86 file { '/etc/cron.d/puppet-bacula-storage-stuff': ensure => absent, }
87 concat::fragment { 'puppet-crontab--bacula-storage':
88 target => '/etc/cron.d/puppet-crontab',
90 @daily bacula chronic /usr/local/bin/bacula-unlink-removed-volumes -v
94 Bacula::Storage::Director<<| tag == 'bacula::to-storage' |>>
95 Bacula::Storage::Client<<| tag == "bacula::to-storage::${::fqdn}" |>>