bacula_dsa_client_list and tag_bacula_dsa_client_list are not parameters
[mirror/dsa-puppet.git] / modules / bacula / manifests / client.pp
index 12f334e..6e9988c 100644 (file)
@@ -8,12 +8,22 @@
 # @param port_fd          port that bacula-fd listens on
 # @param client_name      bacula client name for this instance
 # @param ensure           present or absent
+# @param volume_retention_full  how long to keep volumes with full backups
+# @param volume_retention_diff  how long to keep volumes with differential backups
+# @param volume_retention_inc   how long to keep volumes with incremental backups
+# @param file_retention         how long to keep information about which files are in which volumes/jobs
+# @param job_retention          how long to keep job records
 class bacula::client(
   Stdlib::Host $director_server,
   Stdlib::Host $storage_server,
   Integer $port_fd = 9102,
   String $client_name = "${::fqdn}-fd",
   Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' },
+  String $volume_retention_full = '100 days',
+  String $volume_retention_diff = '50 days',
+  String $volume_retention_inc  = '30 days',
+  String $file_retention = '30 days',
+  String $job_retention = $volume_retention_full,
 ) inherits bacula {
   $package_ensure = $ensure ? { 'present' => 'installed', 'absent' => 'purged' }
   $service_ensure = $ensure ? { 'present' => 'running', 'absent'  => 'stopped' }
@@ -34,20 +44,23 @@ class bacula::client(
   }
 
   if $ensure == 'present' {
-    Bacula::Client::Director <<| tag == "bacula::to-fd::${director_server}" |>>
+    Bacula::Client::Director <<| tag == "bacula::to-fd::${director_server}" |>> {
+      before => Exec['bacula-fd restart-when-idle'],
+    }
 
     @@bacula::storage::client { $client:
-      tag             => "bacula::to-storage::${storage_server}",
-      client          => $client,
-      director_server => $director_server,
+      tag                   => "bacula::to-storage::${storage_server}",
+      client                => $client,
+      director_server       => $director_server,
+      volume_retention_full => $volume_retention_full,
+      volume_retention_diff => $volume_retention_diff,
+      volume_retention_inc  => $volume_retention_inc,
     }
 
     @@concat::fragment { "bacula-dsa-client-list::${client}":
-      target  => $bacula::bacula_dsa_client_list ,
-      content => @("EOF"),
-          ${client}
-          | EOF
       tag     => $bacula::tag_bacula_dsa_client_list,
+      target  => $bacula::bacula_dsa_client_list,
+      content => $client,
     }
 
     # allow access from director
@@ -82,7 +95,16 @@ class bacula::client(
     ensure    => $service_ensure,
     enable    => $service_enable,
     hasstatus => true,
-    require   => Package['bacula-fd']
+  }
+  dsa_systemd::override { 'bacula-fd':
+    ensure  => $ensure,
+    content => @(EOF),
+      [Unit]
+      After=unbound.service
+      [Service]
+      ExecStart=
+      ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
+      | EOF
   }
 
   exec { 'bacula-fd restart-when-idle':
@@ -90,7 +112,7 @@ class bacula::client(
     command     => "sh -c 'setsid /usr/local/sbin/bacula-idle-restart ${port_fd} bacula-fd &'",
     refreshonly => true,
     subscribe   => [ File[$bacula::bacula_ssl_server_cert], File[$bacula::bacula_ssl_client_cert] ],
-    require     => File['/usr/local/sbin/bacula-idle-restart'],
+    require     => [ File['/usr/local/sbin/bacula-idle-restart'], File['/etc/bacula/fd-conf.d/empty.conf'] ],
   }
 
   file { '/etc/bacula/bacula-fd.conf':
@@ -99,7 +121,6 @@ class bacula::client(
     mode    => '0640',
     owner   => root,
     group   => bacula,
-    require => Package['bacula-fd'],
     notify  => Exec['bacula-fd restart-when-idle'],
   }
   file { '/etc/bacula/fd-conf.d/empty.conf':
@@ -107,8 +128,7 @@ class bacula::client(
     content => '',
     mode    => '0440',
     group   => bacula,
-    require => Package['bacula-director-pgsql'],
-    notify  => Exec['bacula-director reload']
+    notify  => Exec['bacula-fd restart-when-idle'],
   }
   file { '/usr/local/sbin/bacula-backup-dirs':
     ensure => $ensure,
@@ -126,20 +146,6 @@ class bacula::client(
     mode    => '0400',
     owner   => root,
     group   => root,
-    require => Package['bacula-fd'],
     notify  => Service['bacula-fd'],
   }
-  if (versioncmp($::lsbmajdistrelease, '9') >= 0 and $facts['systemd']) {
-    dsa_systemd::override { 'bacula-fd':
-      content => @(EOT)
-        [Service]
-        ExecStart=
-        ExecStart=/usr/sbin/bacula-fd -c $CONFIG -f -u bacula -k
-        | EOT
-    }
-  } else {
-    dsa_systemd::override { 'bacula-fd':
-      ensure  => absent,
-    }
-  }
 }