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 # @param director_address address of this sd instance that other instances should connect to (dns name)
12 class bacula::director(
15 String $db_name = 'bacula',
16 String $db_user = 'bacula',
17 String $pool_name = 'bacula',
18 Integer $port_dir = 9101,
19 Optional[String] $db_sslca = undef,
20 #String $director_name = "${::fqdn}-dir",
21 String $director_name = $bacula::bacula_director_name,
22 Stdlib::Host $director_address = $::fqdn,
25 # used by e.g. bconsole
26 $director_secret = hkdf('/etc/puppet/secret', "bacula-dir-${::fqdn}")
27 # the RestoreFiles Job needs a Pool and a client. Any valid pool and client.
28 $some_pool_name = "poolfull-${pool_name}-${director_address}"
29 $some_client_name = "${director_address}-fd"
32 'bacula-director-pgsql',
36 ensure => 'installed',
39 service { 'bacula-director':
43 require => Package['bacula-director-pgsql']
45 dsa_systemd::override { 'bacula-director':
52 exec { 'bacula-director reload':
53 path => '/usr/bin:/usr/sbin:/bin:/sbin',
54 command => 'service bacula-director reload',
58 file { '/etc/bacula/conf.d':
65 source => 'puppet:///files/empty/',
66 notify => Exec['bacula-director reload']
69 file { '/etc/bacula/bacula-dir.conf':
70 content => template('bacula/bacula-dir.conf.erb'),
73 require => Package['bacula-director-pgsql'],
74 notify => Exec['bacula-director reload']
77 file { '/etc/bacula/conf.d/empty.conf':
81 require => Package['bacula-director-pgsql'],
82 notify => Exec['bacula-director reload']
85 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
86 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
88 package { 'bacula-console':
92 file { '/etc/bacula/bconsole.conf':
93 content => template('bacula/bconsole.conf.erb'),
96 require => Package['bacula-console']
99 package { 'python3-psycopg2': ensure => installed }
100 file { '/etc/bacula/scripts/volume-purge-action':
102 source => 'puppet:///modules/bacula/volume-purge-action',
105 file { '/etc/bacula/scripts/volumes-delete-old':
107 source => 'puppet:///modules/bacula/volumes-delete-old',
110 file { '/etc/bacula/storages-list.d':
117 source => 'puppet:///files/empty/',
119 file { '/usr/local/sbin/dsa-bacula-scheduler':
120 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
124 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
125 concat::fragment { 'puppet-crontab--bacula-director':
126 target => '/etc/cron.d/puppet-crontab',
128 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
129 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
130 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
134 concat { $bacula::bacula_dsa_client_list:
136 concat::fragment { 'bacula-dsa-client-list::header' :
137 target => $bacula::bacula_dsa_client_list,
141 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
143 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
144 tag => "bacula::director-to-fd::${::fqdn}",
145 description => 'Allow bacula-fd from the bacula-director',
146 port => '7', # overridden on collecting
147 saddr => $bacula::public_addresses,
149 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
150 tag => 'bacula::director-to-storage',
151 description => 'Allow bacula-storage access from the bacula-director',
152 chain => 'bacula-sd',
153 saddr => $bacula::public_addresses,