bacula directori and storage: whitespace change only
[mirror/dsa-puppet.git] / modules / bacula / manifests / storage.pp
1 class bacula::storage inherits bacula {
2   package { 'bacula-sd':
3     ensure => installed
4   }
5
6   service { 'bacula-sd':
7     ensure    => running,
8     enable    => true,
9     hasstatus => true,
10   }
11   dsa_systemd::override { 'bacula-sd':
12     content => @(EOT)
13       [Service]
14       Group=bacula
15       SupplementaryGroups=ssl-cert
16       | EOT
17   }
18
19   exec { 'bacula-sd restart-when-idle':
20     path        => '/usr/bin:/usr/sbin:/bin:/sbin',
21     command     => 'sh -c "setsid /usr/local/sbin/bacula-idle-restart sd &"',
22     refreshonly => true,
23     subscribe   => File[$bacula_ssl_server_cert],
24     require     => File['/usr/local/sbin/bacula-idle-restart'],
25   }
26
27
28   file { '/etc/bacula/bacula-sd.conf':
29     content => template('bacula/bacula-sd.conf.erb'),
30     mode    => '0640',
31     group   => bacula,
32     notify  => Exec['bacula-sd restart-when-idle']
33   }
34
35   file { '/etc/bacula/storage-conf.d':
36     ensure  => directory,
37     mode    => '0755',
38     group   => bacula,
39     purge   => true,
40     force   => true,
41     recurse => true,
42     source  => 'puppet:///files/empty/',
43     notify  => Exec['bacula-sd restart-when-idle']
44   }
45
46   ferm::rule { 'dsa-bacula-sd-v4':
47     domain      => '(ip)',
48     description => 'Allow bacula-sd access from director and clients',
49     rule        => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V4 5.153.231.125 5.153.231.126) ACCEPT; }',
50     notarule    => true,
51   }
52
53   ferm::rule { 'dsa-bacula-sd-v6':
54     domain      => '(ip6)',
55     description => 'Allow bacula-sd access from director and clients',
56     rule        => 'proto tcp mod state state (NEW) dport (bacula-sd) @subchain \'bacula-sd\' { saddr ($HOST_DEBIAN_V6) ACCEPT; }',
57     notarule    => true,
58   }
59
60   file { '/etc/bacula/storage-conf.d/empty.conf':
61     content => '',
62     mode    => '0440',
63     group   => bacula,
64     notify  => Exec['bacula-sd restart-when-idle']
65   }
66
67   file { "${bacula_backup_path}/Catalog":
68     ensure  => directory,
69     mode    => '0755',
70     owner   => bacula,
71     group   => bacula,
72     ;
73   }
74
75   package { 'python3-psycopg2': ensure => installed }
76   file { '/usr/local/bin/bacula-unlink-removed-volumes':
77     source  => 'puppet:///modules/bacula/bacula-unlink-removed-volumes',
78     mode    => '0555',
79   }
80   file { "/etc/cron.d/puppet-bacula-storage-stuff": ensure => absent, }
81   concat::fragment { 'dsa-puppet-stuff--bacula-storage':
82     target => '/etc/cron.d/dsa-puppet-stuff',
83     content  => @(EOF)
84       @daily bacula chronic /usr/local/bin/bacula-unlink-removed-volumes -v
85       | EOF
86   }
87
88   Bacula::Storage_per_node<<| |>>
89 }