]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Activate postgresql backup in production
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 13 May 2018 22:52:33 +0000 (00:52 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Sun, 13 May 2018 22:56:51 +0000 (00:56 +0200)
modules/role/manifests/cryptoportfolio/postgresql_backup.pp

index c6ca0fa96c5bfad766714117ef3e50b133ea3708..5d937bdf56d70e7617b43c65b10893e7579058ab 100644 (file)
@@ -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":