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,
19 'bacula-director-pgsql',
23 ensure => 'installed',
26 service { 'bacula-director':
30 require => Package['bacula-director-pgsql']
32 dsa_systemd::override { 'bacula-director':
39 exec { 'bacula-director reload':
40 path => '/usr/bin:/usr/sbin:/bin:/sbin',
41 command => 'service bacula-director reload',
45 file { '/etc/bacula/conf.d':
52 source => 'puppet:///files/empty/',
53 notify => Exec['bacula-director reload']
56 file { '/etc/bacula/bacula-dir.conf':
57 content => template('bacula/bacula-dir.conf.erb'),
60 require => Package['bacula-director-pgsql'],
61 notify => Exec['bacula-director reload']
64 file { '/etc/bacula/conf.d/empty.conf':
68 require => Package['bacula-director-pgsql'],
69 notify => Exec['bacula-director reload']
72 Bacula::Director::Client <<| tag == "bacula::to-director::${::fqdn}" |>>
73 Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
75 package { 'bacula-console':
79 file { '/etc/bacula/bconsole.conf':
80 content => template('bacula/bconsole.conf.erb'),
83 require => Package['bacula-console']
86 package { 'python3-psycopg2': ensure => installed }
87 file { '/etc/bacula/scripts/volume-purge-action':
89 source => 'puppet:///modules/bacula/volume-purge-action',
92 file { '/etc/bacula/scripts/volumes-delete-old':
94 source => 'puppet:///modules/bacula/volumes-delete-old',
97 file { '/etc/bacula/storages-list.d':
104 source => 'puppet:///files/empty/',
106 file { '/usr/local/sbin/dsa-bacula-scheduler':
107 source => 'puppet:///modules/bacula/dsa-bacula-scheduler',
111 file { '/etc/cron.d/puppet-bacula-stuff': ensure => absent, }
112 concat::fragment { 'puppet-crontab--bacula-director':
113 target => '/etc/cron.d/puppet-crontab',
115 @daily root chronic /etc/bacula/scripts/volume-purge-action -v
116 @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
117 */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
121 concat { $bacula::bacula_dsa_client_list:
123 concat::fragment { 'bacula-dsa-client-list::header' :
124 target => $bacula::bacula_dsa_client_list,
128 Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
130 @@ferm::rule::simple { "bacula::director-to-fd::${::fqdn}":
131 tag => "bacula::director-to-fd::${::fqdn}",
132 description => 'Allow bacula-fd from the bacula-director',
133 port => '7', # overridden on collecting
134 saddr => $bacula::public_addresses,
136 @@ferm::rule::simple { "bacula::director-to-storage::${::fqdn}":
137 tag => "bacula::director-to-storage::${::fqdn}",
138 description => 'Allow bacula-storage access from the bacula-director',
139 chain => 'bacula-sd',
140 saddr => $bacula::public_addresses,