Skip to content

Commit

Permalink
Merge pull request #5 from EncoreTechnologies/feature/manage_dnf
Browse files Browse the repository at this point in the history
Add support for DNF module management and defaults for PGSQL versions
  • Loading branch information
bishopbm1 authored Aug 30, 2024
2 parents 1813fcf + 2d3eb8e commit 6ef8e78
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v8.1.1] - 2024-08-29

### Added

- Add support for RedHat manage DNF module passthrough for postgresql install.

## [v8.1.0](https://github.com/puppetlabs/puppetlabs-puppetdb/tree/v8.1.0) - 2024-05-07

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppetdb/compare/v8.0.1...v8.1.0)
Expand Down
6 changes: 6 additions & 0 deletions manifests/database/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
# @param manage_database
# If true, the PostgreSQL database will be managed by this module. Defaults to `true`.
#
# @param manage_dnf_module
# If true, the PostgreSQL module will manage the PostgreSQL DNF module. Defaults to `true`
# for RedHat releasever >= '8', otherwise is set to 'false'.
#
# @param manage_server
# Conditionally manages the PostgreSQL server via `postgresql::server`. Defaults
# to `true`. If set to `false`, this class will create the database and user via
Expand Down Expand Up @@ -79,6 +83,7 @@
$database_port = $puppetdb::params::database_port,
$manage_database = $puppetdb::params::manage_database,
$manage_server = $puppetdb::params::manage_dbserver,
$manage_dnf_module = $puppetdb::params::manage_dnf_module,
$manage_package_repo = $puppetdb::params::manage_pg_repo,
$postgres_version = $puppetdb::params::postgres_version,
$postgresql_ssl_on = $puppetdb::params::postgresql_ssl_on,
Expand All @@ -95,6 +100,7 @@

if $manage_server {
class { 'postgresql::globals':
manage_dnf_module => $manage_dnf_module,
manage_package_repo => $manage_package_repo,
version => $postgres_version,
}
Expand Down
36 changes: 33 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,42 @@
$manage_dnf_module = false

if fact('os.family') =~ /RedHat|Debian/ {
$manage_pg_repo = true
$manage_pg_repo = true
} else {
$manage_pg_repo = false
$manage_pg_repo = false
}

$postgres_version = '14'
# Configure the DNF module for PostgreSQL on RHEL 8 and later
if fact('os.family') == 'RedHat' and versioncmp(fact('os.release.major'), '8') >= 0 {
$manage_dnf_module = true
} else {
$manage_dnf_module = false
}

# Set the default PostgreSQL version based on the OS family and version
$postgres_version = fact('os.family') ? {
'RedHat' => fact('os.release.major') ? {
'9' => '15',
'8' => '12',
default => '9.6',
},
'Debian' => fact('os.name') ? {
'Debian' => fact('os.release.major') ? {
'12' => '15',
'11' => '13',
'10' => '11',
default => '9.6',
},
'Ubuntu' => fact('os.release.major') ? {
/^22.04$/ => '14',
/^20.04$/ => '12',
/^18.04$/ => '10',
default => '9.6',
},
default => '9.6',
},
default => '14',
}

$puppetdb_major_version = $puppetdb_version ? {
'latest' => '8',
Expand Down
12 changes: 5 additions & 7 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppetdb",
"version": "8.1.0",
"version": "8.1.1",
"author": "puppetlabs",
"summary": "Installs PostgreSQL and PuppetDB, sets up the connection to Puppet master.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -29,21 +29,19 @@
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"7",
"8"
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
"7",
"8"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"7",
"8"
]
},
Expand All @@ -64,7 +62,8 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
}
],
Expand All @@ -74,7 +73,6 @@
"version_requirement": ">= 7.0.0 < 9.0.0"
}
],
"description": "Module for installing/configuring PuppetDB",
"pdk-version": "3.0.1",
"template-url": "https://github.com/puppetlabs/pdk-templates#3.0.1",
"template-ref": "tags/3.0.1-0-gd13288a"
Expand Down

0 comments on commit 6ef8e78

Please sign in to comment.