Defined Type: postgresql::server::recovery
- Defined in:
- manifests/server/recovery.pp
Summary
This resource manages the parameters that applies to the recovery.conf template.Overview
Note:
Allows you to create the content for recovery.conf. For more details see the usage example and the PostgreSQL documentation. Every parameter value is a string set in the template except recovery_target_inclusive, pause_at_recovery_target, standby_mode and recovery_min_apply_delay. A detailed description of all listed parameters can be found in the PostgreSQL documentation. Only the specified parameters are recognized in the template. The recovery.conf is only created if at least one parameter is set and manage_recovery_conf is set to true.
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 |
# File 'manifests/server/recovery.pp', line 33
define postgresql::server::recovery (
Optional[String] $restore_command = undef,
Optional[String[1]] $archive_cleanup_command = undef,
Optional[String[1]] $recovery_end_command = undef,
Optional[String[1]] $recovery_target_name = undef,
Optional[String[1]] $recovery_target_time = undef,
Optional[String[1]] $recovery_target_xid = undef,
Optional[Boolean] $recovery_target_inclusive = undef,
Optional[String[1]] $recovery_target = undef,
Optional[String[1]] $recovery_target_timeline = undef,
Optional[Boolean] $pause_at_recovery_target = undef,
Optional[String[1]] $standby_mode = undef,
Optional[String[1]] $primary_conninfo = undef,
Optional[String[1]] $primary_slot_name = undef,
Optional[String[1]] $trigger_file = undef,
Optional[Integer] $recovery_min_apply_delay = undef,
Variant[String[1], Stdlib::Absolutepath] $target = $postgresql::server::recovery_conf_path
) {
if $postgresql::server::manage_recovery_conf == false {
fail('postgresql::server::manage_recovery_conf has been disabled, so this resource is now unused and redundant, either enable that option or remove this resource from your manifests') # lint:ignore:140chars
} else {
if($restore_command == undef and $archive_cleanup_command == undef and $recovery_end_command == undef
and $recovery_target_name == undef and $recovery_target_time == undef and $recovery_target_xid == undef
and $recovery_target_inclusive == undef and $recovery_target == undef and $recovery_target_timeline == undef
and $pause_at_recovery_target == undef and $standby_mode == undef and $primary_conninfo == undef
and $primary_slot_name == undef and $trigger_file == undef and $recovery_min_apply_delay == undef) {
fail('postgresql::server::recovery use this resource but do not pass a parameter will avoid creating the recovery.conf, because it makes no sense.') # lint:ignore:140chars
}
concat { $target:
owner => $postgresql::server::user,
group => $postgresql::server::group,
force => true, # do not crash if there is no recovery conf file
mode => '0640',
warn => true,
notify => Class['postgresql::server::reload'],
}
# Create the recovery.conf content
concat::fragment { "${name}-recovery.conf":
target => $target,
content => epp('postgresql/recovery.conf.epp', {
restore_command => $restore_command,
archive_cleanup_command => $archive_cleanup_command,
recovery_end_command => $recovery_end_command,
recovery_target_name => $recovery_target_name,
recovery_target_time => $recovery_target_time,
recovery_target_xid => $recovery_target_xid,
recovery_target_inclusive => $recovery_target_inclusive,
recovery_target => $recovery_target,
recovery_target_timeline => $recovery_target_timeline,
pause_at_recovery_target => $pause_at_recovery_target,
standby_mode => $standby_mode,
primary_conninfo => $primary_conninfo,
primary_slot_name => $primary_slot_name,
trigger_file => $trigger_file,
recovery_min_apply_delay => $recovery_min_apply_delay,
}
),
}
}
}
|