230b29f5ae1246efc5d3d0c300130960c2bb5a50
[mirror/dsa-puppet.git] / modules / bacula / manifests / client.pp
1 class bacula::client inherits bacula {
2         @@bacula::storage-per-node { $::fqdn: }
3
4         if ! getfromhash($site::nodeinfo, 'not-bacula-client') {
5                 @@bacula::node { $::fqdn:
6                         bacula_client_port => $bacula::bacula_client_port,
7                 }
8         }
9
10         package { ['bacula-fd']:
11                 ensure => installed
12         }
13
14         service { 'bacula-fd':
15                 ensure    => running,
16                 enable    => true,
17                 hasstatus => true,
18                 require   => Package['bacula-fd']
19         }
20
21         exec { 'bacula-fd restart-when-idle':
22                 path        => '/usr/bin:/usr/sbin:/bin:/sbin',
23                 command     => 'sh -c "setsid /usr/local/sbin/bacula-idle-restart fd &"',
24                 refreshonly => true,
25                 subscribe   => [ File[$bacula_ssl_server_cert], File[$bacula_ssl_client_cert] ],
26                 require     => File['/usr/local/sbin/bacula-idle-restart'],
27         }
28
29         file { '/etc/bacula/bacula-fd.conf':
30                 content => template('bacula/bacula-fd.conf.erb'),
31                 mode    => '0640',
32                 owner   => root,
33                 group   => bacula,
34                 require => Package['bacula-fd'],
35                 notify  => Exec['bacula-fd restart-when-idle'],
36         }
37         file { '/usr/local/sbin/bacula-backup-dirs':
38                 mode    => '0775',
39                 source  => 'puppet:///modules/bacula/bacula-backup-dirs',
40         }
41         file { '/usr/local/sbin/postbaculajob':
42                 mode    => '0775',
43                 source  => 'puppet:///modules/bacula/postbaculajob',
44         }
45         file { '/etc/default/bacula-fd':
46                 content => template('bacula/default.bacula-fd.erb'),
47                 mode    => '0400',
48                 owner   => root,
49                 group   => root,
50                 require => Package['bacula-fd'],
51                 notify  => Service['bacula-fd'],
52         }
53         if ($::lsbmajdistrelease >= 9 and $systemd) {
54                 file { '/etc/systemd/system/bacula-fd.service.d':
55                         ensure  => directory,
56                         mode    => '0755',
57                         owner   => root,
58                         group   => root,
59                 }
60                 file { '/etc/systemd/system/bacula-fd.service.d/user.conf':
61                         source  => 'puppet:///modules/bacula/bacula-fd-systemd',
62                         mode    => '0400',
63                         owner   => root,
64                         group   => root,
65                         notify  => Exec['systemctl daemon-reload'],
66                 }
67         } else {
68                 file { '/etc/systemd/system/bacula-fd.service.d/user.conf':
69                         ensure  => absent,
70                 }
71         }
72
73         @ferm::rule { 'dsa-bacula-fd-v4':
74                 domain      => '(ip)',
75                 description => 'Allow bacula access from storage and director',
76                 rule        => "proto tcp mod state state (NEW) dport (${bacula_client_port}) saddr (${bacula_director_ip}) ACCEPT",
77         }
78
79         #@ferm::rule { 'dsa-bacula-fd-v6':
80         #       domain      => '(ip6)',
81         #       description => 'Allow bacula access from storage and director',
82         #       rule        => "proto tcp mod state state (NEW) dport (bacula-fd) saddr (${bacula_director_ip6}) ACCEPT",
83         #}
84 }