Skip to content

Commit f76de04

Browse files
authored
Merge pull request #109 from SimonHoenscheid/shoenscheid_make_systemd_timers_configurable
make systemd timers configurable
2 parents c8376a3 + d391423 commit f76de04

File tree

2 files changed

+33
-13
lines changed

2 files changed

+33
-13
lines changed

manifests/init.pp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@
1010
# Manage table settings
1111
# @param install_dir [String] Directory to install module into (Default: "/opt/puppetlabs/pe_databases")
1212
# @param scripts_dir [String] Directory to install scripts into (Default: "${install_dir}/scripts")
13+
# @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
14+
# @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
15+
# @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
16+
# @param reports_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'reports' tables
17+
# @param resource_events_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'resource_events' tables
1318
class pe_databases (
14-
Boolean $manage_database_maintenance = true,
15-
Boolean $disable_maintenance = false,
16-
Boolean $manage_postgresql_settings = true,
17-
Boolean $manage_table_settings = false,
18-
String $install_dir = '/opt/puppetlabs/pe_databases',
19-
String $scripts_dir = "${install_dir}/scripts"
19+
Boolean $manage_database_maintenance = true,
20+
Boolean $disable_maintenance = false,
21+
Boolean $manage_postgresql_settings = true,
22+
Boolean $manage_table_settings = false,
23+
String[1] $install_dir = '/opt/puppetlabs/pe_databases',
24+
String[1] $scripts_dir = "${install_dir}/scripts",
25+
String[1] $facts_tables_repack_timer = 'Tue,Sat *-*-* 04:30:00',
26+
String[1] $catalogs_tables_repack_timer = 'Sun,Thu *-*-* 04:30:00',
27+
String[1] $other_tables_repack_timer = '*-*-20 05:30:00',
28+
String[1] $reports_tables_repack_timer = '*-*-10 05:30:00',
29+
String[1] $resource_events_tables_repack_timer = '*-*-15 05:30:00',
2030
) {
2131
$psql_version = $facts['pe_postgresql_info']['installed_server_version'] ? {
2232
undef => undef,

manifests/pg_repack.pp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,19 @@
66
# @param disable_maintenance [Boolean] true or false (Default: false)
77
# Disable or enable maintenance mode
88
# @param jobs [Integer] How many jobs to run in parallel
9+
# @param facts_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'facts' tables
10+
# @param catalogs_tables_repack_timer [String]The Systemd timer for the pg_repack job affecting the 'catalog' tables
11+
# @param other_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'other' tables
12+
# @param reports_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'reports' tables
13+
# @param resource_events_tables_repack_timer [String] The Systemd timer for the pg_repack job affecting the 'resource_events' tables
914
class pe_databases::pg_repack (
10-
Boolean $disable_maintenance = false,
11-
Integer $jobs = $facts['processors']['count'] / 4
15+
Boolean $disable_maintenance = false,
16+
Integer $jobs = $facts['processors']['count'] / 4,
17+
String[1] $facts_tables_repack_timer = $pe_databases::facts_tables_repack_timer,
18+
String[1] $catalogs_tables_repack_timer = $pe_databases::catalogs_tables_repack_timer,
19+
String[1] $other_tables_repack_timer = $pe_databases::other_tables_repack_timer,
20+
String[1] $reports_tables_repack_timer = $pe_databases::reports_tables_repack_timer,
21+
String[1] $resource_events_tables_repack_timer = $pe_databases::resource_events_tables_repack_timer,
1222
) {
1323
# PE 2019.1 starting shipping versioned pe-postgres packages where all paths are versioned.
1424
# So, prior to 2019.1 use a non-versioned path, and after use a versioned path.
@@ -33,34 +43,34 @@
3343
pe_databases::collect { 'facts':
3444
disable_maintenance => $disable_maintenance,
3545
command => "${repack} ${repack_jobs} ${facts_tables}",
36-
on_cal => 'Tue,Sat *-*-* 04:30:00',
46+
on_cal => $facts_tables_repack_timer,
3747
}
3848

3949
pe_databases::collect { 'catalogs':
4050
disable_maintenance => $disable_maintenance,
4151
command => "${repack} ${repack_jobs} ${catalogs_tables}",
42-
on_cal => 'Sun,Thu *-*-* 04:30:00',
52+
on_cal => $catalogs_tables_repack_timer,
4353
}
4454

4555
pe_databases::collect { 'other':
4656
disable_maintenance => $disable_maintenance,
4757
command => "${repack} ${repack_jobs} ${other_tables}",
48-
on_cal => '*-*-20 05:30:00',
58+
on_cal => $other_tables_repack_timer,
4959
}
5060

5161
if versioncmp($facts['pe_server_version'], '2019.7.0') < 0 {
5262
pe_databases::collect { 'reports':
5363
disable_maintenance => $disable_maintenance,
5464
command => "${repack} ${repack_jobs} ${reports_table}",
55-
on_cal => '*-*-10 05:30:00',
65+
on_cal => $reports_tables_repack_timer,
5666
}
5767
}
5868

5969
if versioncmp($facts['pe_server_version'], '2019.3.0') < 0 {
6070
pe_databases::collect { 'resource_events':
6171
disable_maintenance => $disable_maintenance,
6272
command => "${repack} ${repack_jobs} ${resource_events_table}",
63-
on_cal => '*-*-15 05:30:00',
73+
on_cal => $resource_events_tables_repack_timer,
6474
}
6575
}
6676

0 commit comments

Comments
 (0)