Rename our systemd module to dsa_systemd
[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         dsa_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         file { '/etc/bacula/conf.d/empty.conf':
46                 content => '',
47                 mode    => '0440',
48                 group   => bacula,
49                 require => Package['bacula-director-pgsql'],
50                 notify  => Exec['bacula-director reload']
51         }
52
53         Bacula::Node<<| |>>
54
55         package { 'bacula-console':
56                 ensure => installed;
57         }
58
59         file { '/etc/bacula/bconsole.conf':
60                 content => template('bacula/bconsole.conf.erb'),
61                 mode    => '0640',
62                 group   => bacula,
63                 require => Package['bacula-console']
64         }
65
66         package { 'python3-psycopg2': ensure => installed }
67         file { '/etc/bacula/scripts/volume-purge-action':
68                 mode    => '0555',
69                 source  => 'puppet:///modules/bacula/volume-purge-action',
70                 ;
71         }
72         file { '/etc/bacula/scripts/volumes-delete-old':
73                 mode    => '0555',
74                 source  => 'puppet:///modules/bacula/volumes-delete-old',
75                 ;
76         }
77         file { '/etc/bacula/storages-list.d':
78                 ensure  => directory,
79                 mode    => '0755',
80                 group   => bacula,
81                 purge   => true,
82                 force   => true,
83                 recurse => true,
84                 source  => 'puppet:///files/empty/',
85         }
86         file { '/usr/local/sbin/dsa-bacula-scheduler':
87                 source  => 'puppet:///modules/bacula/dsa-bacula-scheduler',
88                 mode    => '0555',
89         }
90
91         file { "/etc/cron.d/puppet-bacula-stuff": ensure => absent, }
92         concat::fragment { 'dsa-puppet-stuff--bacula-director':
93                 target => '/etc/cron.d/dsa-puppet-stuff',
94                 content  => @(EOF)
95                         @daily root chronic /etc/bacula/scripts/volume-purge-action -v
96                         @daily root chronic /etc/bacula/scripts/volumes-delete-old -v
97                         */3 * * * * root sleep $(( $RANDOM \% 60 )); flock -w 0 -e /usr/local/sbin/dsa-bacula-scheduler /usr/local/sbin/dsa-bacula-scheduler
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 }