From 71e446a82e7249c69793bda0b93fbf7a024c88a5 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Wed, 6 Sep 2023 16:18:52 +0200 Subject: [PATCH] add port and psql_path parameter to initdb define --- REFERENCE.md | 20 +++++++++++++ manifests/server/instance/initdb.pp | 45 +++++++++++++++++------------ 2 files changed, 47 insertions(+), 18 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index a4b40059e7..f96f38e548 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -2673,6 +2673,8 @@ The following parameters are available in the `postgresql::server::instance::ini * [`user`](#-postgresql--server--instance--initdb--user) * [`username`](#-postgresql--server--instance--initdb--username) * [`xlogdir`](#-postgresql--server--instance--initdb--xlogdir) +* [`port`](#-postgresql--server--instance--initdb--port) +* [`psql_path`](#-postgresql--server--instance--initdb--psql_path) ##### `auth_host` @@ -2824,6 +2826,24 @@ PostgreSQL xlog/WAL directory Default value: `$postgresql::server::xlogdir` +##### `port` + +Data type: `Stdlib::Port` + +Specifies the port for the PostgreSQL server to listen on. +Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems, +changing the port causes the server to come to a full stop before being able to make the change. + +Default value: `$postgresql::server::port` + +##### `psql_path` + +Data type: `Stdlib::Absolutepath` + +Specifies the path to the psql command. + +Default value: `$postgresql::server::psql_path` + ### `postgresql::server::instance::late_initdb` Manage the default encoding when database initialization is managed by the package diff --git a/manifests/server/instance/initdb.pp b/manifests/server/instance/initdb.pp index 97584c9d64..5944207bc1 100644 --- a/manifests/server/instance/initdb.pp +++ b/manifests/server/instance/initdb.pp @@ -25,25 +25,32 @@ # @param user Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system. # @param username username of user running the postgres instance # @param xlogdir PostgreSQL xlog/WAL directory +# @param port +# Specifies the port for the PostgreSQL server to listen on. +# Note: The same port number is used for all IP addresses the server listens on. Also, for Red Hat systems and early Debian systems, +# changing the port causes the server to come to a full stop before being able to make the change. +# @param psql_path Specifies the path to the psql command. define postgresql::server::instance::initdb ( - Optional[String[1]] $auth_host = $postgresql::server::auth_host, - Optional[String[1]] $auth_local = $postgresql::server::auth_local, - Optional[Boolean] $data_checksums = $postgresql::server::data_checksums, - Stdlib::Absolutepath $datadir = $postgresql::server::datadir, - Optional[String[1]] $encoding = $postgresql::server::encoding, - String[1] $group = $postgresql::server::group, - Stdlib::Absolutepath $initdb_path = $postgresql::server::initdb_path, - Optional[String[1]] $lc_messages = $postgresql::server::lc_messages, - Optional[String[1]] $locale = $postgresql::server::locale, - Optional[Stdlib::Absolutepath] $logdir = $postgresql::server::logdir, - Boolean $manage_datadir = $postgresql::server::manage_datadir, - Boolean $manage_logdir = $postgresql::server::manage_logdir, - Boolean $manage_xlogdir = $postgresql::server::manage_xlogdir, - Stdlib::Absolutepath $module_workdir = $postgresql::server::module_workdir, - Boolean $needs_initdb = $postgresql::server::needs_initdb, - String[1] $user = $postgresql::server::user, - Optional[String[1]] $username = $postgresql::server::username, - Optional[Stdlib::Absolutepath] $xlogdir = $postgresql::server::xlogdir, + Optional[String[1]] $auth_host = $postgresql::server::auth_host, + Optional[String[1]] $auth_local = $postgresql::server::auth_local, + Optional[Boolean] $data_checksums = $postgresql::server::data_checksums, + Stdlib::Absolutepath $datadir = $postgresql::server::datadir, + Optional[String[1]] $encoding = $postgresql::server::encoding, + String[1] $group = $postgresql::server::group, + Stdlib::Absolutepath $initdb_path = $postgresql::server::initdb_path, + Optional[String[1]] $lc_messages = $postgresql::server::lc_messages, + Optional[String[1]] $locale = $postgresql::server::locale, + Optional[Stdlib::Absolutepath] $logdir = $postgresql::server::logdir, + Boolean $manage_datadir = $postgresql::server::manage_datadir, + Boolean $manage_logdir = $postgresql::server::manage_logdir, + Boolean $manage_xlogdir = $postgresql::server::manage_xlogdir, + Stdlib::Absolutepath $module_workdir = $postgresql::server::module_workdir, + Boolean $needs_initdb = $postgresql::server::needs_initdb, + String[1] $user = $postgresql::server::user, + Optional[String[1]] $username = $postgresql::server::username, + Optional[Stdlib::Absolutepath] $xlogdir = $postgresql::server::xlogdir, + Stdlib::Port $port = $postgresql::server::port, + Stdlib::Absolutepath $psql_path = $postgresql::server::psql_path, ) { if $facts['os']['family'] == 'RedHat' and $facts['os']['selinux']['enabled'] == true { $seltype = 'postgresql_db_t' @@ -190,6 +197,8 @@ user => $user, group => $group, module_workdir => $module_workdir, + psql_path => $psql_path, + port => $port, } } }