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 dir 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"
31 # let the SD know we exist
32 @@bacula::storage::director{ $::fqdn:
33 tag => 'bacula::to-storage',
34 director_name => $director_name,
35 director_address => $director_address,
39 'bacula-director-pgsql',
43 ensure => 'installed',
46 service { 'bacula-director':
50 require => Package['bacula-director-pgsql']
52 dsa_systemd::override { 'bacula-director':
59 exec { 'bacula-director reload':
60 path => '/usr/bin:/usr/sbin:/bin:/sbin',
61 command => 'service bacula-director reload',
65 file { '/etc/bacula/conf.d':
72 source => 'puppet:///files/empty/',
73 notify => Exec['bacula-director reload']
76 file { '/etc/bacula/bacula-dir.conf':
77 content => template('bacula/bacula-dir.conf.erb'),
80 require => Package['bacula-director-pgsql'],
81 notify => Exec['bacula-director reload']
84 file { '/etc/bacula/conf.d/empty.conf':
88 require => Package['bacula-director-pgsql'],
89 notify => Exec['bacula-director reload']
92 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
93 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
95 package { 'bacula-console':
99 file { '/etc/bacula/bconsole.conf':
100 content => template('bacula/bconsole.conf.erb'),
103 require => Package['bacula-console']
106 package { 'python3-psycopg2': ensure => installed }
107 file { '/etc/bacula/scripts/volume-purge-action':
109 source => 'puppet:///modules/bacula/volume-purge-action',
112 file { '/etc/bacula/scripts/volumes-delete-old':
114 source => 'puppet:///modules/bacula/volumes-delete-old',
117 file { '/etc/bacula/storages-list.d':
124 source => 'puppet:///files/empty/',
126 file { '/usr/local/sbin/dsa-bacula-scheduler':
127 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
131 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
132 concat::fragment { 'puppet-crontab--bacula-director':
133 target => '/etc/cron.d/puppet-crontab',
135 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
136 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
137 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
141 concat { $bacula::bacula_dsa_client_list:
143 concat::fragment { 'bacula-dsa-client-list::header' :
144 target => $bacula::bacula_dsa_client_list,
148 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
150 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
151 tag => "bacula::director-to-fd::${::fqdn}",
152 description => 'Allow bacula-fd from the bacula-director',
153 port => '7', # overridden on collecting
154 saddr => $bacula::public_addresses,
156 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
157 tag => 'bacula::director-to-storage',
158 description => 'Allow bacula-storage access from the bacula-director',
159 chain => 'bacula-sd',
160 saddr => $bacula::public_addresses,