From: Peter Palfrader Date: Sun, 29 Sep 2019 14:30:28 +0000 (+0200) Subject: Allow us to gradually move a server with multiple clusters to move to managed hba X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=2e6fa9d0a37eb696efc95c75279d35e338dcf898;p=mirror%2Fdsa-puppet.git Allow us to gradually move a server with multiple clusters to move to managed hba --- diff --git a/modules/roles/manifests/postgresql/server.pp b/modules/roles/manifests/postgresql/server.pp index 99a82376b..fd8f9164b 100644 --- a/modules/roles/manifests/postgresql/server.pp +++ b/modules/roles/manifests/postgresql/server.pp @@ -3,18 +3,24 @@ # # @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 class roles::postgresql::server( - Boolean $manage_clusters_hba = false, + Variant[Boolean,Array[Integer]] $manage_clusters_hba = false, ) { $clusters = $facts['postgresql_clusters'] $clusters.each |$cluster| { $version = $cluster['version'] $cluster_name = $cluster['cluster'] $port = $cluster['port'] + + 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, } } }