3 # @param pool_name A string 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 class bacula::director(
13 String $db_name = 'bacula',
14 String $db_user = 'bacula',
15 String $pool_name = 'bacula',
16 Integer $port_dir = 9101,
17 Optional[String] $db_sslca = undef,
20 # the RestoreFiles Job needs a Pool. Any valid pool.
21 $some_pool_name = "poolfull-${pool_name}-${bacula::bacula_director_address}"
24 'bacula-director-pgsql',
28 ensure => 'installed',
31 service { 'bacula-director':
35 require => Package['bacula-director-pgsql']
37 dsa_systemd::override { 'bacula-director':
44 exec { 'bacula-director reload':
45 path => '/usr/bin:/usr/sbin:/bin:/sbin',
46 command => 'service bacula-director reload',
50 file { '/etc/bacula/conf.d':
57 source => 'puppet:///files/empty/',
58 notify => Exec['bacula-director reload']
61 file { '/etc/bacula/bacula-dir.conf':
62 content => template('bacula/bacula-dir.conf.erb'),
65 require => Package['bacula-director-pgsql'],
66 notify => Exec['bacula-director reload']
69 file { '/etc/bacula/conf.d/empty.conf':
73 require => Package['bacula-director-pgsql'],
74 notify => Exec['bacula-director reload']
77 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
78 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
80 package { 'bacula-console':
84 file { '/etc/bacula/bconsole.conf':
85 content => template('bacula/bconsole.conf.erb'),
88 require => Package['bacula-console']
91 package { 'python3-psycopg2': ensure => installed }
92 file { '/etc/bacula/scripts/volume-purge-action':
94 source => 'puppet:///modules/bacula/volume-purge-action',
97 file { '/etc/bacula/scripts/volumes-delete-old':
99 source => 'puppet:///modules/bacula/volumes-delete-old',
102 file { '/etc/bacula/storages-list.d':
109 source => 'puppet:///files/empty/',
111 file { '/usr/local/sbin/dsa-bacula-scheduler':
112 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
116 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
117 concat::fragment { 'puppet-crontab--bacula-director':
118 target => '/etc/cron.d/puppet-crontab',
120 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
121 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
122 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
126 concat { $bacula::bacula_dsa_client_list:
128 concat::fragment { 'bacula-dsa-client-list::header' :
129 target => $bacula::bacula_dsa_client_list,
133 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
135 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
136 tag => "bacula::director-to-fd::${::fqdn}",
137 description => 'Allow bacula-fd from the bacula-director',
138 port => '7', # overridden on collecting
139 saddr => $bacula::public_addresses,
141 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
142 tag => "bacula::director-to-storage::${::fqdn}",
143 description => 'Allow bacula-storage access from the bacula-director',
144 chain => 'bacula-sd',
145 saddr => $bacula::public_addresses,