Puppet Class: borg

Defined in:
manifests/init.pp

Overview

Main class, includes all other classes.

Parameters:

  • package_name (Variant[String[1],Array[String[1]]])

    Name of the borg package

  • create_prometheus_metrics (Boolean) (defaults to: true)

    Enable a postrun command to create prometheus compatible metrics about all backups

  • use_upstream_reporter (Boolean) (defaults to: false)

    Enable to upstream reporter (see create_prometheus_metrics param) or our vendored version

  • update_borg_restore_db_after_backuprun (Boolean) (defaults to: true)

    Enable the restore helper from Florian ‘Bluewind’ Pritz (metacpan.org/release/App-BorgRestore) as another postrun command (see also the install_restore_script parameter)

  • manage_prune (Boolean) (defaults to: true)

    Enable management of backup prunes. If this is set to ‘false` all `keep_*` parameters are ignored.

  • keep_yearly (Integer[0]) (defaults to: 3)

    For how many years should we keep our backups?

  • keep_monthly (Integer[0]) (defaults to: 24)

    For how many months should we keep our backups?

  • keep_weekly (Integer[0]) (defaults to: 36)

    For how many weeks should we keep our backups?

  • keep_daily (Integer[0]) (defaults to: 60)

    For how many days should we keep our backups?

  • keep_within (Integer[0]) (defaults to: 30)

    For how many days should we keep all backups we have?

  • compression (String[1]) (defaults to: 'lz4')

    Compression method and level to use. See the output of ‘borg help compression` for available options.

  • working_directory (Stdlib::Absolutepath) (defaults to: '/')

    The working directory from where the backup should be created.

  • source_paths (Array[String[1]]) (defaults to: ['/'])

    A list of relative or absolute paths to backup.

  • excludes (Array[Stdlib::Absolutepath]) (defaults to: ['/tmp', '/sys', '/dev', '/proc', '/run', '/media', '/var/lib/nfs/rpc_pipefs'])

    list of default mountpoints that should be excluded from backups. Every mountpoint needs to be explicitly excluded or included. See also the additional_excludes parameter.

  • includes (Array[Stdlib::Absolutepath]) (defaults to: ['/', '/boot', '/boot/efi', '/boot/EFI', '/var/log'])

    list of default mountpoints that should be included from backups. Every mountpoint needs to be explicitly excluded or included. See also the additional_includes parameter.

  • backupserver (String[1])

    FQDN for the remote server. Will be written into the local ssh client configuration file.

  • install_restore_script (Boolean)

    Install the restore helper via cpanm.

  • restore_script_path (Stdlib::Absolutepath)

    The path to the restore helper.

  • backupdestdir (String[1]) (defaults to: 'borg')

    The path on the remote server where the backups should be written to. $username will be prepended

  • backupdatadir (Stdlib::Absolutepath) (defaults to: '/root/backup-data/')

    The path where additional backup data should be stored.

  • absolutebackupdestdir (Optional[String[1]]) (defaults to: undef)

    By defaults, backups will be written on the remote host to $username/$backupdestdir. if $absolutebackupdestdir is set this will be used instead

  • manage_repository (Boolean)

    A Boolean that enables/disables repository management. Only true on Ubuntu 16.04 at the moment

  • exclude_pattern (Array[String[1]]) (defaults to: ['sh:/home/*/.cache/*', 'sh:/root/.cache/*', 'sh:/var/cache/pacman/pkg/*'])

    We currently support excludes/includes for mountpoints. borg supports also a list of shell glob/regex pattern to filter for files.

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

    Another array of patterns to extend the modules built-in list (‘exclude_pattern` parameter).

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

    A list of dependencies for the restore helper.

  • package_ensure (String[1]) (defaults to: present)

    Ensure state for the borg package.

  • additional_excludes (Array[Stdlib::Absolutepath]) (defaults to: [])

    Another array of mountpoints to extend the modules built-in list (‘excludes` parameter).

  • additional_includes (Array[Stdlib::Absolutepath]) (defaults to: [])

    Another array of mountpoints to extend to modules built-in list (‘includes` parameter).

  • username (String[1]) (defaults to: $facts['networking']['hostname'])

    The ssh username to connect to the remote borg service.

  • ssh_port (Stdlib::Port) (defaults to: 22)

    SSH port for the remote server (default: 22). Will be written into the local ssh client configuration file.

  • borg_restore_version (Pattern[/^\d*\.\d*\.\d*$/]) (defaults to: '3.4.5')

    Version for the perl script App::BorgRestore. change this version and the module will upgrade/downgrade it

  • install_fatpacked_cpanm (Boolean)

    cpanm is required on systems where we want to have App::BorgRestore. Legacy systems ship a too old cpanm version. For those operating systems we can install the upstream version.

  • proxy_type (Optional[Enum['none', 'ftp','http','https']]) (defaults to: undef)

    configue a network proxy type for the archive resources in this module. You also need to set ‘proxy_server` if you need a proxy.

  • proxy_server (Optional[String[1]]) (defaults to: undef)

    Configurea network proxy for the archive resources in this module. By default no proxy will be used

  • manage_package (Boolean) (defaults to: true)

    Enable/Disable management of the actual borg package. People on legacy OS or isolated environments can disable this and manage the binary in their profile.

  • ssh_key_type (Enum['rsa', 'ed25519']) (defaults to: 'ed25519')

    configure your most favourite ssh key type. This will be used to connect to the remote borg server.

  • backuptime (Hash[String[1],String[1]]) (defaults to: { 'default' => '18:30:00' })

    Configure the name of each backupjob and the time of that job.

  • ssh_proxyjump (Optional[String[1]]) (defaults to: undef)

    Configure possible bastionhosts for the connection.

  • wants (Array[String[1]]) (defaults to: ['network-online.target'])

    Array of units where the borg-backup service should depend on

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

    Array of units which the borg-backup service should require

  • after (Array[String[1]]) (defaults to: ['network-online.target'])

    Array of units that should be started before the borg-backup service

  • pre_backup_script (Optional[String[1]]) (defaults to: undef)

    BASH code to be executed before the backup job starts. If you wish to use snapshots, create them here.

  • post_backup_script (Optional[String[1]]) (defaults to: undef)

    BASH code to be executed after the backup job has finished. If you need to perform any cleanup do so here.

  • restore_package (Optional[String[1]]) (defaults to: undef)

    Optional package name for the perl based script

  • upload_ratelimit (Integer[0]) (defaults to: 0)

    Upload ratelimit in kiByte/s. Default: 0=unlimited

See Also:



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'manifests/init.pp', line 140

class borg (
  Variant[String[1],Array[String[1]]] $package_name,
  String[1] $backupserver,
  Boolean $install_restore_script,
  Stdlib::Absolutepath $restore_script_path,
  Boolean $manage_repository,
  Boolean $install_fatpacked_cpanm,
  Boolean $create_prometheus_metrics                       = true,
  Boolean $use_upstream_reporter                           = false,
  Boolean $update_borg_restore_db_after_backuprun          = true,
  Boolean $manage_prune                                    = true,
  Integer[0] $keep_yearly                                  = 3,
  Integer[0] $keep_monthly                                 = 24,
  Integer[0] $keep_weekly                                  = 36,
  Integer[0] $keep_daily                                   = 60,
  Integer[0] $keep_within                                  = 30,
  String[1] $compression                                   = 'lz4',
  Stdlib::Absolutepath $working_directory                  = '/',
  Array[String[1]] $source_paths                           = ['/'],
  Array[Stdlib::Absolutepath] $excludes                    = ['/tmp', '/sys', '/dev', '/proc', '/run', '/media', '/var/lib/nfs/rpc_pipefs'],
  Array[Stdlib::Absolutepath] $includes                    = ['/', '/boot', '/boot/efi', '/boot/EFI', '/var/log'],
  String[1] $backupdestdir                                 = 'borg',
  Stdlib::Absolutepath $backupdatadir                      = '/root/backup-data/',
  Optional[String[1]] $absolutebackupdestdir               = undef,
  Array[String[1]] $exclude_pattern                        = ['sh:/home/*/.cache/*', 'sh:/root/.cache/*', 'sh:/var/cache/pacman/pkg/*'],
  Array[String[1]] $additional_exclude_pattern             = [],
  Array[String[1]] $restore_dependencies                   = [],
  String[1] $package_ensure                                = present,
  Array[Stdlib::Absolutepath] $additional_excludes         = [],
  Array[Stdlib::Absolutepath] $additional_includes         = [],
  String[1] $username                                      = $facts['networking']['hostname'],
  Stdlib::Port $ssh_port                                   = 22,
  Pattern[/^\d*\.\d*\.\d*$/] $borg_restore_version         = '3.4.5',
  Optional[Enum['none', 'ftp','http','https']] $proxy_type = undef,
  Optional[String[1]] $proxy_server                        = undef,
  Boolean $manage_package                                  = true,
  Enum['rsa', 'ed25519'] $ssh_key_type                     = 'ed25519',
  Hash[String[1],String[1]] $backuptime                    = { 'default' => '18:30:00' },
  Optional[String[1]] $ssh_proxyjump                       = undef,
  Array[String[1]] $wants                                  = ['network-online.target'],
  Array[String[1]] $requires                               = [],
  Array[String[1]] $after                                  = ['network-online.target'],
  Optional[String[1]] $pre_backup_script                   = undef,
  Optional[String[1]] $post_backup_script                  = undef,
  Optional[String[1]] $restore_package                     = undef,
  Integer[0] $upload_ratelimit                             = 0,
) {
  contain borg::install
  contain borg::config
  contain borg::service

  Class['borg::install']
  -> Class['borg::config']
  ~> Class['borg::service']
}