collect backup client list in a plain text file
[mirror/dsa-puppet.git] / modules / bacula / manifests / director.pp
1 class bacula::director inherits bacula {
2
3         package { ['bacula-director-pgsql', 'bacula-common', 'bacula-common-pgsql']:
4                 ensure => installed
5         }
6
7         service { 'bacula-director':
8                 ensure    => running,
9                 enable    => true,
10                 hasstatus => true,
11                 require   => Package['bacula-director-pgsql']
12         }
13         systemd::override { 'bacula-director':
14                 content => @(EOT)
15                         [Unit]
16                         After=unbound.service
17                         | EOT
18         }
19
20         exec { 'bacula-director reload':
21                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
22                 command     => 'service bacula-director reload',
23                 refreshonly => true,
24         }
25
26         file { '/etc/bacula/conf.d':
27                 ensure  => directory,
28                 mode    => '0755',
29                 group   => bacula,
30                 purge   => true,
31                 force   => true,
32                 recurse => true,
33                 source  => 'puppet:///files/empty/',
34                 notify  => Exec['bacula-director reload']
35         }
36
37         file { '/etc/bacula/bacula-dir.conf':
38                 content => template('bacula/bacula-dir.conf.erb'),
39                 mode    => '0440',
40                 group   => bacula,
41                 require => Package['bacula-director-pgsql'],
42                 notify  => Exec['bacula-director reload']
43         }
44
45         @ferm::rule { 'dsa-bacula-dir':
46                 domain      => '(ip)',
47                 description => 'Allow bacula access from localhost',
48                 rule        => "proto tcp mod state state (NEW) dport (bacula-dir) saddr (${bacula_director_ip} localhost) ACCEPT",
49         }
50
51         file { '/etc/bacula/conf.d/empty.conf':
52                 content => '',
53                 mode    => '0440',
54                 group   => bacula,
55                 require => Package['bacula-director-pgsql'],
56                 notify  => Exec['bacula-director reload']
57         }
58
59         Bacula::Node<<| |>>
60
61         package { 'bacula-console':
62                 ensure => installed;
63         }
64
65         file { '/etc/bacula/bconsole.conf':
66                 content => template('bacula/bconsole.conf.erb'),
67                 mode    => '0640',
68                 group   => bacula,
69                 require => Package['bacula-console']
70         }
71
72         package { 'python3-psycopg2': ensure => installed }
73         file { '/etc/bacula/scripts/volume-purge-action':
74                 mode    => '0555',
75                 source  => 'puppet:///modules/bacula/volume-purge-action',
76                 ;
77         }
78         file { '/etc/bacula/scripts/volumes-delete-old':
79                 mode    => '0555',
80                 source  => 'puppet:///modules/bacula/volumes-delete-old',
81                 ;
82         }
83         file { '/etc/bacula/storages-list.d':
84                 ensure  => directory,
85                 mode    => '0755',
86                 group   => bacula,
87                 purge   => true,
88                 force   => true,
89                 recurse => true,
90                 source  => 'puppet:///files/empty/',
91         }
92         file { "/etc/cron.d/puppet-bacula-stuff": ensure => absent, }
93         concat::fragment { 'dsa-puppet-stuff--bacula-director':
94                 target => '/etc/cron.d/dsa-puppet-stuff',
95                 content  => @(EOF)
96                         @daily root chronic /etc/bacula/scripts/volume-purge-action -v
97                         @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
98                         | EOF
99         }
100
101         concat { $bacula::bacula_dsa_client_list:
102         }
103         concat::fragment { 'bacula-dsa-client-list::header' :
104                 target => $bacula::bacula_dsa_client_list,
105                 content  => "",
106                 order  => '00',
107         }
108         Concat::Fragment <<| tag == $bacula::tag_bacula_dsa_client_list |>>
109 }