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 db_sslca SSL CA store for DB access
9 class bacula::director(
12 String $db_name = 'bacula',
13 String $db_user = 'bacula',
14 String $pool_name = 'bacula',
15 Optional[String] $db_sslca = undef,
18 # the RestoreFiles Job needs a Pool. Any valid pool.
19 $some_pool_name = "poolfull-${pool_name}-${bacula::bacula_director_address}"
22 'bacula-director-pgsql',
26 ensure => 'installed',
29 service { 'bacula-director':
33 require => Package['bacula-director-pgsql']
35 dsa_systemd::override { 'bacula-director':
42 exec { 'bacula-director reload':
43 path => '/usr/bin:/usr/sbin:/bin:/sbin',
44 command => 'service bacula-director reload',
48 file { '/etc/bacula/conf.d':
55 source => 'puppet:///files/empty/',
56 notify => Exec['bacula-director reload']
59 file { '/etc/bacula/bacula-dir.conf':
60 content => template('bacula/bacula-dir.conf.erb'),
63 require => Package['bacula-director-pgsql'],
64 notify => Exec['bacula-director reload']
67 file { '/etc/bacula/conf.d/empty.conf':
71 require => Package['bacula-director-pgsql'],
72 notify => Exec['bacula-director reload']
75 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
76 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
78 package { 'bacula-console':
82 file { '/etc/bacula/bconsole.conf':
83 content => template('bacula/bconsole.conf.erb'),
86 require => Package['bacula-console']
89 package { 'python3-psycopg2': ensure => installed }
90 file { '/etc/bacula/scripts/volume-purge-action':
92 source => 'puppet:///modules/bacula/volume-purge-action',
95 file { '/etc/bacula/scripts/volumes-delete-old':
97 source => 'puppet:///modules/bacula/volumes-delete-old',
100 file { '/etc/bacula/storages-list.d':
107 source => 'puppet:///files/empty/',
109 file { '/usr/local/sbin/dsa-bacula-scheduler':
110 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
114 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
115 concat::fragment { 'puppet-crontab--bacula-director':
116 target => '/etc/cron.d/puppet-crontab',
118 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
119 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
120 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
124 concat { $bacula::bacula_dsa_client_list:
126 concat::fragment { 'bacula-dsa-client-list::header' :
127 target => $bacula::bacula_dsa_client_list,
131 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
133 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
134 tag => "bacula::director-to-fd::${::fqdn}",
135 description => 'Allow bacula-fd from the bacula-director',
136 port => '7', # overridden on collecting
137 saddr => $bacula::public_addresses,
139 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
140 tag => "bacula::director-to-storage::${::fqdn}",
141 description => 'Allow bacula-storage access from the bacula-director',
142 chain => 'bacula-sd',
143 saddr => $bacula::public_addresses,