File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 2929 String $daily_databases_path = " ${pe_databases::install_dir} /default_daily_databases.txt" ,
3030 String $backup_logging_directory = ' /var/log/puppetlabs/pe_databases_backup' ,
3131 Integer $retention_policy = 2,
32+ Boolean $disable_maintenance = true ,
3233) {
3334
3435 file { $backup_logging_directory :
6263 refreshonly => true ,
6364 }
6465
66+ $cron_ensure = $disable_maintenance ? {
67+ false => ' present' ,
68+ default => ' absent' ,
69+ }
70+
6571 # Since the cron job titles below include the array ('databases') of database names,
6672 # the crontab for pe-postgres needs to be reset if the array of database names changes,
6773 # otherwise the change create a new cron job and unmanage the old cron job.
7278 $databases_to_backup = $database_backup_set [' databases' ]
7379 $databases = join($databases_to_backup , ' ' )
7480 cron { "puppet_enterprise_database_backup_${databases_to_backup}" :
75- ensure => present ,
81+ ensure => $cron_ensure ,
7682 command => " ${backup_script_path} -l ${backup_logging_directory} -t ${backup_directory} -r ${retention_policy} ${databases} " ,
7783 user => ' pe-postgres' ,
7884 minute => $database_backup_set [' schedule' ][' minute' ],
Original file line number Diff line number Diff line change 33# @summary Tuning, maintenance, and backups for PE PostgreSQL.
44
55class pe_databases (
6- Boolean $manage_database_backups = false ,
6+ Variant[ Boolean, Undef ] $manage_database_backups = undef ,
77 # Manage the inclusion of the pg_repack class
88 Boolean $manage_database_maintenance = true ,
99 # Manage the state of the maintenance tasks, i.e. systemd services and timers
4141 # In PE XL, the Master and Replica run PostgreSQL for all databases *except* for pe-puppetdb.
4242 include pe_databases::postgresql_settings::table_settings
4343 }
44-
45- if $manage_database_backups {
46- include pe_databases::backup
47- }
4844 }
4945 else {
5046 notify { 'pe_databases_version_warn' :
5147 message => ' This module only supports PE 2019.0.2 and later' ,
5248 loglevel => warning ,
5349 }
5450 }
51+ if defined (' $manage_database_backups' ) {
52+ class { 'pe_databases::backup' :
53+ disable_maintenance => ! $manage_database_backups ,
54+ }
55+ }
5556 }
5657 else {
5758 notify { 'pe_databases_systemd_warn' :
You can’t perform that action at this time.
0 commit comments