pg config on ullmann, pt 1
[mirror/dsa-puppet.git] / modules / roles / manifests / postgresql / server.pp
index cd774ba..3b6dfcb 100644 (file)
@@ -1,20 +1,29 @@
 #
 # postgresql server role
 #
-# @param manage_clusters_hba manage clusters' pg_hba.conf using postgres::cluster.  Eventually should should be true for every host and we can drop the param
+# @param manage_clusters_hba  manage clusters' pg_hba.conf using postgres::cluster.  Eventually should should be true for every host and we can drop the param
+# @param backups              Do backups of the database clusters on this host
 class roles::postgresql::server(
-  Boolean $manage_clusters_hba = false,
+  Variant[Boolean,Array[Integer]] $manage_clusters_hba = false,
+  Boolean $backups = true,
 ) {
   $clusters = $facts['postgresql_clusters']
   $clusters.each |$cluster| {
     $version      = $cluster['version']
     $cluster_name = $cluster['cluster']
     $port         = $cluster['port']
-    postgres::cluster { 'bacula':
+
+    if $manage_clusters_hba =~ Boolean {
+      $hba = $manage_clusters_hba
+    } else {
+      $hba = $port in $manage_clusters_hba
+    }
+    postgres::cluster { "${version}::${cluster_name}":
       pg_version => $version,
       pg_cluster => $cluster_name,
       pg_port    => $port,
-      manage_hba => $manage_clusters_hba,
+      manage_hba => $hba,
+      backups    => $backups,
     }
   }
 }