File tree 2 files changed +13
-6
lines changed
2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 29
29
String $daily_databases_path = " ${pe_databases::install_dir} /default_daily_databases.txt" ,
30
30
String $backup_logging_directory = ' /var/log/puppetlabs/pe_databases_backup' ,
31
31
Integer $retention_policy = 2,
32
+ Boolean $disable_maintenance = true ,
32
33
) {
33
34
34
35
file { $backup_logging_directory :
62
63
refreshonly => true ,
63
64
}
64
65
66
+ $cron_ensure = $disable_maintenance ? {
67
+ false => ' present' ,
68
+ default => ' absent' ,
69
+ }
70
+
65
71
# Since the cron job titles below include the array ('databases') of database names,
66
72
# the crontab for pe-postgres needs to be reset if the array of database names changes,
67
73
# otherwise the change create a new cron job and unmanage the old cron job.
72
78
$databases_to_backup = $database_backup_set [' databases' ]
73
79
$databases = join($databases_to_backup , ' ' )
74
80
cron { "puppet_enterprise_database_backup_${databases_to_backup}" :
75
- ensure => present ,
81
+ ensure => $cron_ensure ,
76
82
command => " ${backup_script_path} -l ${backup_logging_directory} -t ${backup_directory} -r ${retention_policy} ${databases} " ,
77
83
user => ' pe-postgres' ,
78
84
minute => $database_backup_set [' schedule' ][' minute' ],
Original file line number Diff line number Diff line change 3
3
# @summary Tuning, maintenance, and backups for PE PostgreSQL.
4
4
5
5
class pe_databases (
6
- Boolean $manage_database_backups = false ,
6
+ Variant[ Boolean, Undef ] $manage_database_backups = undef ,
7
7
# Manage the inclusion of the pg_repack class
8
8
Boolean $manage_database_maintenance = true ,
9
9
# Manage the state of the maintenance tasks, i.e. systemd services and timers
41
41
# In PE XL, the Master and Replica run PostgreSQL for all databases *except* for pe-puppetdb.
42
42
include pe_databases::postgresql_settings::table_settings
43
43
}
44
-
45
- if $manage_database_backups {
46
- include pe_databases::backup
47
- }
48
44
}
49
45
else {
50
46
notify { 'pe_databases_version_warn' :
51
47
message => ' This module only supports PE 2019.0.2 and later' ,
52
48
loglevel => warning ,
53
49
}
54
50
}
51
+ if defined (' $manage_database_backups' ) {
52
+ class { 'pe_databases::backup' :
53
+ disable_maintenance => ! $manage_database_backups ,
54
+ }
55
+ }
55
56
}
56
57
else {
57
58
notify { 'pe_databases_systemd_warn' :
You can’t perform that action at this time.
0 commit comments