From ff5eb974f840f7f20d22db940eadf9da0c241a14 Mon Sep 17 00:00:00 2001 From: Maggie Dreyer Date: Mon, 4 Oct 2021 18:03:25 -0700 Subject: [PATCH] (SERVER-2500) Use DNF modules to install postgres on RHEL 8 The postgresql module added support for DNF modules to install postgres at specific versions on RHEL 8. However in order to install a non-default version, like we need to test Puppet Platform 6, which only supports Postgres 9.6, `manage_dnf_module` must be set to true for the `puppetlabs-postgresql` module. This commit ensures that mode is set when isntalling on RHEL 8. Note that when the default version is being installed (postgres 10 on RHEL8), the code path that this flag opts into is already being used. --- manifests/database/postgresql.pp | 3 ++- manifests/params.pp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/database/postgresql.pp b/manifests/database/postgresql.pp index 060fff31..24862bad 100644 --- a/manifests/database/postgresql.pp +++ b/manifests/database/postgresql.pp @@ -10,6 +10,7 @@ $manage_database = $puppetdb::params::manage_database, $manage_server = $puppetdb::params::manage_dbserver, $manage_package_repo = $puppetdb::params::manage_pg_repo, + $manage_dnf_module = $puppetdb::params::manage_pg_dnf_module, $postgres_version = $puppetdb::params::postgres_version, $postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on, $postgresql_ssl_key_path = $puppetdb::params::postgresql_ssl_key_path, @@ -19,10 +20,10 @@ $read_database_password = $puppetdb::params::read_database_password, $read_database_host = $puppetdb::params::read_database_host ) inherits puppetdb::params { - if $manage_server { class { '::postgresql::globals': manage_package_repo => $manage_package_repo, + manage_dnf_module => $manage_dnf_module, version => $postgres_version, } # get the pg server up and running diff --git a/manifests/params.pp b/manifests/params.pp index d53b50de..e864ebe2 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -25,6 +25,12 @@ $manage_pg_repo = false } + if $::osfamily =~ /RedHat/ and $facts['os']['release']['major'] == '8' { + $manage_pg_dnf_module = true + } else { + $manage_pg_dnf_module = false + } + if $puppetdb_version in ['latest','present'] or versioncmp($puppetdb_version, '7.0.0') >= 0 { $postgres_version = '11' } else {