Puppet Class: bacula::storage

Inherits:
bacula
Defined in:
manifests/storage.pp

Summary

Configure a Bacula Storage Daemon

Overview

This class configures the Bacula storage daemon.

Parameters:

  • services (String)

    A list of services to operate; loaded from hiera

  • packages (Array[String])

    A list of packages to install; loaded from hiera

  • conf_dir (String) (defaults to: $bacula::conf_dir)

    Path to bacula configuration directory

  • device (String) (defaults to: '/bacula')

    The system file name of the storage device managed by this storage daemon

  • device_mode (Stdlib::Filemode) (defaults to: '0770')

    The posix mode for device

  • device_name (String) (defaults to: "${trusted['certname']}-device")

    The Name that the Director will use when asking to backup or restore to or from to this device

  • device_owner (String) (defaults to: $bacula::bacula_user)

    The posix user owning the device directory

  • device_seltype (String) (defaults to: $bacula::device_seltype)

    SELinux type for the device

  • director_name (String) (defaults to: $bacula::director_name)

    Specifies the Name of the Director allowed to connect to the Storage daemon

  • group (String) (defaults to: $bacula::bacula_group)

    The posix group for bacula

  • homedir (String) (defaults to: $bacula::homedir)

    The directory in which the Storage daemon may put its status files

  • listen_address (Array[String[1]]) (defaults to: [])

    The listening IP addresses for the storage daemon The notes for ‘bacula::client::listen_address` apply.

  • maxconcurjobs (Integer) (defaults to: 5)

    maximum number of Jobs that may run concurrently

  • media_type (String) (defaults to: 'File')

    The type of media supported by this device

  • password (String) (defaults to: 'secret')

    Specifies the password that must be supplied by the named Director

  • port (Integer) (defaults to: 9103)

    The listening port for the Storage Daemon

  • rundir (String) (defaults to: $bacula::rundir)

    The directory in which the Director may put its process Id file files

  • storage (String) (defaults to: $trusted['certname'])

    The address to be configured on the director to communicate with this storage server

  • address (String) (defaults to: $facts['networking']['fqdn'])

    The listening address for the Storage Daemon

  • user (String) (defaults to: $bacula::bacula_user)

    The posix user for bacula



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'manifests/storage.pp', line 27

class bacula::storage (
  String              $services,
  Array[String]       $packages,
  String              $conf_dir       = $bacula::conf_dir,
  String              $device         = '/bacula',
  Stdlib::Filemode    $device_mode    = '0770',
  String              $device_name    = "${trusted['certname']}-device",
  String              $device_owner   = $bacula::bacula_user,
  String              $device_seltype = $bacula::device_seltype,
  String              $director_name  = $bacula::director_name,
  String              $group          = $bacula::bacula_group,
  String              $homedir        = $bacula::homedir,
  Array[String[1]]    $listen_address = [],
  Integer             $maxconcurjobs  = 5,
  String              $media_type     = 'File',
  String              $password       = 'secret',
  Integer             $port           = 9103,
  String              $rundir         = $bacula::rundir,
  String              $storage        = $trusted['certname'], # storage here is not storage_name
  String              $address        = $facts['networking']['fqdn'],
  String              $user           = $bacula::bacula_user,
) inherits bacula {
  # Allow for package names to include EPP syntax for db_type
  $package_names = $packages.map |$p| {
    $package_name = inline_epp($p,
      {
        'db_type' => $bacula::db_type
      }
    )
  }
  ensure_packages($package_names)

  service { $services:
    ensure  => running,
    enable  => true,
    require => Package[$package_names],
  }

  concat::fragment { 'bacula-storage-header':
    order   => '00',
    target  => "${conf_dir}/bacula-sd.conf",
    content => epp('bacula/bacula-sd-header.epp'),
  }

  bacula::storage::device { $device_name:
    device        => $device,
    maxconcurjobs => $maxconcurjobs,
  }

  concat::fragment { 'bacula-storage-dir':
    target  => "${conf_dir}/bacula-sd.conf",
    content => epp('bacula/bacula-sd-dir.epp'),
  }

  bacula::messages { 'Standard-sd':
    daemon   => 'sd',
    director => "${director_name}-dir = all",
    append   => '"/var/log/bacula/bacula-sd.log" = all, !skipped',
  }

  # Realize the clause the director is exporting here so we can allow access to
  # the storage daemon Adds an entry to ${conf_dir}/bacula-sd.conf
  Concat::Fragment <<| tag == "bacula-storage-dir-${director_name}" |>>

  concat { "${conf_dir}/bacula-sd.conf":
    owner     => 'root',
    group     => $group,
    mode      => '0640',
    show_diff => false,
    notify    => Service[$services],
  }

  @@bacula::director::storage { $storage:
    address       => $address,
    port          => $port,
    password      => $password,
    device_name   => $device_name,
    media_type    => $media_type,
    maxconcurjobs => $maxconcurjobs,
    tag           => "bacula-${director_name}",
  }
}