3 # @param pool_name A token to be used in pool names
4 # @param db_address hostname of the postgres server for the catalog DB
5 # @param db_port port of the postgres server for the catalog DB
6 # @param db_name DB name for the catalog DB
7 # @param db_user username for the postgres server for the catalog DB
8 # @param port_dir Port that the director should listen on
9 # @param db_sslca SSL CA store for DB access
10 # @param director_name bacula name of this dir instance
11 class bacula::director(
14 String $db_name = 'bacula',
15 String $db_user = 'bacula',
16 String $pool_name = 'bacula',
17 Integer $port_dir = 9101,
18 Optional[String] $db_sslca = undef,
19 #String $director_name = "${::fqdn}-dir",
20 String $director_name = $bacula::bacula_director_name,
23 # used by e.g. bconsole
24 $director_secret = hkdf('/etc/puppet/secret', "bacula-dir-${::fqdn}")
25 # the RestoreFiles Job needs a Pool. Any valid pool.
26 $some_pool_name = "poolfull-${pool_name}-${bacula::bacula_director_address}"
29 'bacula-director-pgsql',
33 ensure => 'installed',
36 service { 'bacula-director':
40 require => Package['bacula-director-pgsql']
42 dsa_systemd::override { 'bacula-director':
49 exec { 'bacula-director reload':
50 path => '/usr/bin:/usr/sbin:/bin:/sbin',
51 command => 'service bacula-director reload',
55 file { '/etc/bacula/conf.d':
62 source => 'puppet:///files/empty/',
63 notify => Exec['bacula-director reload']
66 file { '/etc/bacula/bacula-dir.conf':
67 content => template('bacula/bacula-dir.conf.erb'),
70 require => Package['bacula-director-pgsql'],
71 notify => Exec['bacula-director reload']
74 file { '/etc/bacula/conf.d/empty.conf':
78 require => Package['bacula-director-pgsql'],
79 notify => Exec['bacula-director reload']
82 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
83 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
85 package { 'bacula-console':
89 file { '/etc/bacula/bconsole.conf':
90 content => template('bacula/bconsole.conf.erb'),
93 require => Package['bacula-console']
96 package { 'python3-psycopg2': ensure => installed }
97 file { '/etc/bacula/scripts/volume-purge-action':
99 source => 'puppet:///modules/bacula/volume-purge-action',
102 file { '/etc/bacula/scripts/volumes-delete-old':
104 source => 'puppet:///modules/bacula/volumes-delete-old',
107 file { '/etc/bacula/storages-list.d':
114 source => 'puppet:///files/empty/',
116 file { '/usr/local/sbin/dsa-bacula-scheduler':
117 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
121 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
122 concat::fragment { 'puppet-crontab--bacula-director':
123 target => '/etc/cron.d/puppet-crontab',
125 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
126 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
127 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
131 concat { $bacula::bacula_dsa_client_list:
133 concat::fragment { 'bacula-dsa-client-list::header' :
134 target => $bacula::bacula_dsa_client_list,
138 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
140 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
141 tag => "bacula::director-to-fd::${::fqdn}",
142 description => 'Allow bacula-fd from the bacula-director',
143 port => '7', # overridden on collecting
144 saddr => $bacula::public_addresses,
146 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
147 tag => "bacula::director-to-storage::${::fqdn}",
148 description => 'Allow bacula-storage access from the bacula-director',
149 chain => 'bacula-sd',
150 saddr => $bacula::public_addresses,