Skip to content

Commit

Permalink
allow setting archive mode to always (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
saz committed Dec 13, 2023
1 parent 5963faa commit 7845452
Showing 1 changed file with 75 additions and 70 deletions.
145 changes: 75 additions & 70 deletions manifests/postgres.pp
Original file line number Diff line number Diff line change
Expand Up @@ -226,73 +226,74 @@
# Copyright 2012-2017 2ndQuadrant Italia
#
class barman::postgres (
Boolean $manage_barman_server = true,
Boolean $manage_dbuser = true,
String $host_group = $barman::host_group,
String $wal_level = 'archive',
String $barman_user = $barman::user,
String $barman_dbuser = $barman::dbuser,
String $barman_dbname = $barman::dbname,
String $barman_home = $barman::home,
Boolean $manage_cron = true,
String $cron_user = 'root',
Optional[Integer] $backup_mday = undef,
Optional[Integer] $backup_wday = undef,
Integer $backup_hour = 4,
Integer $backup_minute = 0,
Barman::Password $password = undef,
String $server_address = $facts['networking']['fqdn'],
Integer $server_port = 5432,
String $postgres_server_id = $facts['networking']['hostname'],
String $postgres_user = 'postgres',
String $ensure = 'present',
String $conf_template = 'barman/server.conf.erb',
String $description = $name,
Boolean $archiver = $barman::archiver,
Optional[Integer] $archiver_batch_size = $barman::archiver_batch_size,
Optional[Stdlib::Absolutepath] $backup_directory = undef,
Barman::BackupMethod $backup_method = $barman::backup_method,
Barman::BackupOptions $backup_options = $barman::backup_options,
Optional[Integer] $bandwidth_limit = $barman::bandwidth_limit,
Optional[Stdlib::Absolutepath] $basebackups_directory = undef,
Optional[Integer] $basebackup_retry_sleep = $barman::basebackup_retry_sleep,
Optional[Integer] $basebackup_retry_times = $barman::basebackup_retry_times,
Optional[Integer] $check_timeout = $barman::check_timeout,
Variant[String,Boolean] $compression = $barman::compression,
Optional[String] $custom_compression_filter = $barman::custom_compression_filter,
Optional[String] $custom_decompression_filter = $barman::custom_decompression_filter,
Optional[Stdlib::Absolutepath] $errors_directory = undef,
Boolean $immediate_checkpoint = $barman::immediate_checkpoint,
Optional[Stdlib::Absolutepath] $incoming_wals_directory = undef,
Barman::BackupAge $last_backup_maximum_age = $barman::last_backup_maximum_age,
Integer $minimum_redundancy = $barman::minimum_redundancy,
Boolean $manage_ssh_host_keys = $barman::manage_ssh_host_keys,
Optional[Boolean] $network_compression = $barman::network_compression,
Optional[Integer] $parallel_jobs = $barman::parallel_jobs,
Optional[Stdlib::Absolutepath] $path_prefix = $barman::path_prefix,
Optional[String] $post_archive_retry_script = $barman::post_archive_retry_script,
Optional[String] $post_archive_script = $barman::post_archive_script,
Optional[String] $post_backup_retry_script = $barman::post_backup_retry_script,
Optional[String] $post_backup_script = $barman::post_backup_script,
Optional[String] $pre_archive_retry_script = $barman::pre_archive_retry_script,
Optional[String] $pre_archive_script = $barman::pre_archive_script,
Optional[String] $pre_backup_retry_script = $barman::pre_backup_retry_script,
Optional[String] $pre_backup_script = $barman::pre_backup_script,
Barman::RecoveryOptions $recovery_options = $barman::recovery_options,
Barman::RetentionPolicy $retention_policy = $barman::retention_policy,
Barman::RetentionPolicyMode $retention_policy_mode = $barman::retention_policy_mode,
Barman::ReuseBackup $reuse_backup = $barman::reuse_backup,
Optional[String] $slot_name = $barman::slot_name,
Boolean $streaming_archiver = $barman::streaming_archiver,
Optional[Integer] $streaming_archiver_batch_size = $barman::streaming_archiver_batch_size,
Optional[String] $streaming_archiver_name = $barman::streaming_archiver_name,
Optional[String] $streaming_backup_name = $barman::streaming_backup_name,
Optional[String] $streaming_conninfo = undef,
Optional[String] $streaming_wals_directory = undef,
Optional[String] $tablespace_bandwidth_limit = $barman::tablespace_bandwidth_limit,
Barman::WalRetention $wal_retention_policy = $barman::wal_retention_policy,
Optional[Stdlib::Absolutepath] $wals_directory = undef,
Optional[String] $custom_lines = $barman::custom_lines,
Boolean $manage_barman_server = true,
Boolean $manage_dbuser = true,
String $host_group = $barman::host_group,
String $wal_level = 'archive',
String $barman_user = $barman::user,
String $barman_dbuser = $barman::dbuser,
String $barman_dbname = $barman::dbname,
String $barman_home = $barman::home,
Boolean $manage_cron = true,
String $cron_user = 'root',
Optional[Integer] $backup_mday = undef,
Optional[Integer] $backup_wday = undef,
Integer $backup_hour = 4,
Integer $backup_minute = 0,
Barman::Password $password = undef,
String $server_address = $facts['networking']['fqdn'],
Integer $server_port = 5432,
String $postgres_server_id = $facts['networking']['hostname'],
String $postgres_user = 'postgres',
String $ensure = 'present',
String $conf_template = 'barman/server.conf.erb',
String $description = $name,
Boolean $archiver = $barman::archiver,
Optional[Integer] $archiver_batch_size = $barman::archiver_batch_size,
Optional[Enum['on', 'off', 'always']] $force_archive_mode = undef,
Optional[Stdlib::Absolutepath] $backup_directory = undef,
Barman::BackupMethod $backup_method = $barman::backup_method,
Barman::BackupOptions $backup_options = $barman::backup_options,
Optional[Integer] $bandwidth_limit = $barman::bandwidth_limit,
Optional[Stdlib::Absolutepath] $basebackups_directory = undef,
Optional[Integer] $basebackup_retry_sleep = $barman::basebackup_retry_sleep,
Optional[Integer] $basebackup_retry_times = $barman::basebackup_retry_times,
Optional[Integer] $check_timeout = $barman::check_timeout,
Variant[String,Boolean] $compression = $barman::compression,
Optional[String] $custom_compression_filter = $barman::custom_compression_filter,
Optional[String] $custom_decompression_filter = $barman::custom_decompression_filter,
Optional[Stdlib::Absolutepath] $errors_directory = undef,
Boolean $immediate_checkpoint = $barman::immediate_checkpoint,
Optional[Stdlib::Absolutepath] $incoming_wals_directory = undef,
Barman::BackupAge $last_backup_maximum_age = $barman::last_backup_maximum_age,
Integer $minimum_redundancy = $barman::minimum_redundancy,
Boolean $manage_ssh_host_keys = $barman::manage_ssh_host_keys,
Optional[Boolean] $network_compression = $barman::network_compression,
Optional[Integer] $parallel_jobs = $barman::parallel_jobs,
Optional[Stdlib::Absolutepath] $path_prefix = $barman::path_prefix,
Optional[String] $post_archive_retry_script = $barman::post_archive_retry_script,
Optional[String] $post_archive_script = $barman::post_archive_script,
Optional[String] $post_backup_retry_script = $barman::post_backup_retry_script,
Optional[String] $post_backup_script = $barman::post_backup_script,
Optional[String] $pre_archive_retry_script = $barman::pre_archive_retry_script,
Optional[String] $pre_archive_script = $barman::pre_archive_script,
Optional[String] $pre_backup_retry_script = $barman::pre_backup_retry_script,
Optional[String] $pre_backup_script = $barman::pre_backup_script,
Barman::RecoveryOptions $recovery_options = $barman::recovery_options,
Barman::RetentionPolicy $retention_policy = $barman::retention_policy,
Barman::RetentionPolicyMode $retention_policy_mode = $barman::retention_policy_mode,
Barman::ReuseBackup $reuse_backup = $barman::reuse_backup,
Optional[String] $slot_name = $barman::slot_name,
Boolean $streaming_archiver = $barman::streaming_archiver,
Optional[Integer] $streaming_archiver_batch_size = $barman::streaming_archiver_batch_size,
Optional[String] $streaming_archiver_name = $barman::streaming_archiver_name,
Optional[String] $streaming_backup_name = $barman::streaming_backup_name,
Optional[String] $streaming_conninfo = undef,
Optional[String] $streaming_wals_directory = undef,
Optional[String] $tablespace_bandwidth_limit = $barman::tablespace_bandwidth_limit,
Barman::WalRetention $wal_retention_policy = $barman::wal_retention_policy,
Optional[Stdlib::Absolutepath] $wals_directory = undef,
Optional[String] $custom_lines = $barman::custom_lines,
) {
if !defined(Class['postgresql::server']) {
fail('barman::server requires the postgresql::server module installed and configured')
Expand All @@ -304,9 +305,13 @@
default => $password,
}

$archive_mode = $archiver ? {
true => 'on',
default => 'off',
if $force_archive_mode {
$archive_mode = $force_archive_mode
} else {
$archive_mode = $archiver ? {
true => 'on',
default => 'off',
}
}

# Configure PostgreSQL server for archive mode
Expand Down

0 comments on commit 7845452

Please sign in to comment.