Move list of clusters to make a base backup of from the script to a conffile
[mirror/dsa-puppet.git] / modules / postgres / manifests / backup_server / register_backup_cluster.pp
index 0fd482c..44a1e42 100644 (file)
@@ -1,12 +1,23 @@
 #
+# Cause our pg backup servers to run base backups of
+# this postgres cluster and add the cluster to the
+# monitoring configuration.
+#
+# @param hostname     name of the db server
+# @param fqdn         fqdn of the db server
+# @param pg_port      port of the postgres cluster
+# @param pg_role      replication role username
+# @param pg_password  password of the replication role
+# @param pg_cluster   cluster name
+# @param pg_version   pg version of the cluster
 define postgres::backup_server::register_backup_cluster (
-  $hostname = $::hostname,
-  $fqdn = $::fqdn,
-  $pg_port,
-  $pg_role,
-  $pg_password,
-  $pg_cluster,
-  $pg_version,
+  String $hostname = $::hostname,
+  String $fqdn = $::fqdn,
+  Integer $pg_port,
+  String $pg_role,
+  String $pg_password,
+  String $pg_cluster,
+  String $pg_version,
 ) {
   include postgres::backup_server::globals
 
@@ -18,24 +29,22 @@ define postgres::backup_server::register_backup_cluster (
         | EOF
     tag     => $postgres::backup_server::globals::tag_source_pgpassline,
   }
-  #
-  # vittoria.debian.org  5432  debian-backup    main    9.6
+  # example entry:
+  #   vittoria.debian.org  5432  debian-backup    main    9.6
   @@concat::fragment { "postgresql::server::backup-source-make-base-backup-entry::$hostname::$pg_port::$pg_role":
-    target => $postgres::backup_server::globals::make_base_backups,
-    content => @("EOF"),
-        ${fqdn}  ${pg_port}  ${pg_role}  ${pg_cluster}  ${pg_version}
-        | EOF
     tag     => $postgres::backup_server::globals::tag_base_backup,
+    target  => $postgres::backup_server::globals::base_backup_clusters,
+    content => "${::fqdn} ${pg_port} ${pg_role} ${pg_cluster} ${pg_version}",
   }
 
   @@file { "/etc/dsa/postgresql-backup/dsa-check-backuppg.conf.d/${hostname}-${pg_cluster}.conf":
-    content  => @("EOF"),
+    content => @("EOF"),
         --- 
         backups:
           ${hostname}:
             ${pg_cluster}:
         | EOF
-    tag     => $postgres::backup_server::globals::tag_dsa_check_backupp,
-    notify  => Exec['update dsa-check-backuppg-manual.conf']
+    tag    => $postgres::backup_server::globals::tag_dsa_check_backupp,
+    notify => Exec['update dsa-check-backuppg-manual.conf']
   }
 }