diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-28 13:22:48 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2018-06-28 13:22:48 +0200 |
commit | ffcffbcb52dad28d28a0d36c989182e0716edd53 (patch) | |
tree | 70d16fe4702767da332bfed13b8287339a1bf943 /modules/profile/manifests/postgresql | |
parent | 95416ae2301b936829cab964792a8a1e07b06720 (diff) | |
parent | bd9c5fa8864e6531bc8bcb4ce8ad72551d668865 (diff) | |
download | Puppet-ffcffbcb52dad28d28a0d36c989182e0716edd53.tar.gz Puppet-ffcffbcb52dad28d28a0d36c989182e0716edd53.tar.zst Puppet-ffcffbcb52dad28d28a0d36c989182e0716edd53.zip |
Merge branch 'fix_dumps' into dev
Diffstat (limited to 'modules/profile/manifests/postgresql')
-rw-r--r-- | modules/profile/manifests/postgresql/backup_dump.pp | 13 | ||||
-rw-r--r-- | modules/profile/manifests/postgresql/backup_replication.pp | 6 |
2 files changed, 15 insertions, 4 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 @@ | |||
1 | define profile::postgresql::backup_dump ( | 1 | define 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, |
diff --git a/modules/profile/manifests/postgresql/backup_replication.pp b/modules/profile/manifests/postgresql/backup_replication.pp index a4edb8f..1526123 100644 --- a/modules/profile/manifests/postgresql/backup_replication.pp +++ b/modules/profile/manifests/postgresql/backup_replication.pp | |||
@@ -61,6 +61,8 @@ define profile::postgresql::backup_replication ( | |||
61 | target => "$pg_path/pg_hba.conf", | 61 | target => "$pg_path/pg_hba.conf", |
62 | } | 62 | } |
63 | } else { | 63 | } else { |
64 | $pg_listen_port = undef | ||
65 | |||
64 | concat::fragment { "$pg_path/postgresql.conf listen": | 66 | concat::fragment { "$pg_path/postgresql.conf listen": |
65 | target => "$pg_path/postgresql.conf", | 67 | target => "$pg_path/postgresql.conf", |
66 | content => "listen_addresses = ''\n", | 68 | content => "listen_addresses = ''\n", |
@@ -130,6 +132,8 @@ define profile::postgresql::backup_replication ( | |||
130 | } | 132 | } |
131 | 133 | ||
132 | # Dumps | 134 | # Dumps |
133 | profile::postgresql::backup_dump { "$base_path/$pg_backup_host": } | 135 | profile::postgresql::backup_dump { "$base_path/$pg_backup_host": |
136 | pg_port => $pg_listen_port, | ||
137 | } | ||
134 | 138 | ||
135 | } | 139 | } |