aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/manifests/postgresql/backup_dump.pp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/profile/manifests/postgresql/backup_dump.pp')
-rw-r--r--modules/profile/manifests/postgresql/backup_dump.pp13
1 files changed, 10 insertions, 3 deletions
diff --git a/modules/profile/manifests/postgresql/backup_dump.pp b/modules/profile/manifests/postgresql/backup_dump.pp
index 10e349a..53fb20e 100644
--- a/modules/profile/manifests/postgresql/backup_dump.pp
+++ b/modules/profile/manifests/postgresql/backup_dump.pp
@@ -1,6 +1,7 @@
1define profile::postgresql::backup_dump ( 1define profile::postgresql::backup_dump (
2 String $pg_user = "postgres", 2 String $pg_user = "postgres",
3 String $pg_group = "postgres", 3 String $pg_group = "postgres",
4 Optional[Variant[String, Integer]] $pg_port = undef,
4) { 5) {
5 $base_path = $title 6 $base_path = $title
6 $pg_path = "$base_path/postgresql" 7 $pg_path = "$base_path/postgresql"
@@ -23,12 +24,18 @@ define profile::postgresql::backup_dump (
23 require => File[$base_path], 24 require => File[$base_path],
24 } 25 }
25 26
27 if $pg_port and !empty($pg_port) {
28 $pg_port_arg = " -p $pg_port"
29 } else {
30 $pg_port_arg = ""
31 }
32
26 cron::job::multiple { "backup_psql_$pg_host": 33 cron::job::multiple { "backup_psql_$pg_host":
27 ensure => "present", 34 ensure => "present",
28 require => [File[$pg_backup_path], File[$pg_path]], 35 require => [File[$pg_backup_path], File[$pg_path]],
29 jobs => [ 36 jobs => [
30 { 37 {
31 command => "/usr/bin/pg_dumpall -h $pg_path -f $pg_backup_path/\$(date -Iseconds).sql", 38 command => "/usr/bin/pg_dumpall -h $pg_path$pg_port_arg -f $pg_backup_path/\$(date -Iseconds).sql",
32 user => $pg_user, 39 user => $pg_user,
33 hour => "22,4,10,16", 40 hour => "22,4,10,16",
34 minute => 0, 41 minute => 0,