From: Ismaƫl Bouya Date: Sun, 13 May 2018 22:52:33 +0000 (+0200) Subject: Activate postgresql backup in production X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=b0439bf9b68d4e11a1511b289cba15ea10588d8d;p=perso%2FImmae%2FProjets%2FPuppet.git Activate postgresql backup in production --- diff --git a/modules/role/manifests/cryptoportfolio/postgresql_backup.pp b/modules/role/manifests/cryptoportfolio/postgresql_backup.pp index c6ca0fa..5d937bd 100644 --- a/modules/role/manifests/cryptoportfolio/postgresql_backup.pp +++ b/modules/role/manifests/cryptoportfolio/postgresql_backup.pp @@ -14,7 +14,7 @@ class role::cryptoportfolio::postgresql_backup inherits role::backup { ensure_packages(["postgresql"]) - $pg_backup_hosts = ["cryptoportfolio-dev.immae.eu"] + $pg_backup_hosts = ["cryptoportfolio-dev.immae.eu", "cryptoportfolio.immae.eu"] $pg_backup_hosts.each |$pg_backup_host| { $pg_path = "$mountpoint/$pg_backup_host/postgresql" @@ -120,17 +120,19 @@ class role::cryptoportfolio::postgresql_backup inherits role::backup { postgresql_version => "10", } + $primary_conninfo = "host=$pg_host port=$pg_port user=$ldap_cn password=$ldap_password sslmode=require" + $primary_slot_name = regsubst($ldap_cn, '-', "_", "G") + $standby_mode = "on" + concat { "$pg_path/recovery.conf": owner => $pg_user, group => $pg_group, mode => '0640', warn => true, } - postgresql::server::recovery { "$pg_backup_host recovery": - primary_conninfo => "host=$pg_host port=$pg_port user=$ldap_cn password=$ldap_password sslmode=require", - primary_slot_name => regsubst($ldap_cn, '-', "_", "G"), - standby_mode => "on", - target => "$pg_path/recovery.conf", + concat::fragment { "$pg_path/recovery.conf": + target => "$pg_path/recovery.conf", + content => template('postgresql/recovery.conf.erb'), } file { "$pg_path/postgresql.conf":