Skip to content

add port and psql_path parameter to initdb define #1510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

##### <a name="-postgresql--server--instance--initdb--auth_host"></a>`auth_host`

Expand Down Expand Up @@ -2824,6 +2826,24 @@ PostgreSQL xlog/WAL directory

Default value: `$postgresql::server::xlogdir`

##### <a name="-postgresql--server--instance--initdb--port"></a>`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`

##### <a name="-postgresql--server--instance--initdb--psql_path"></a>`psql_path`

Data type: `Stdlib::Absolutepath`

Specifies the path to the psql command.

Default value: `$postgresql::server::psql_path`

### <a name="postgresql--server--instance--late_initdb"></a>`postgresql::server::instance::late_initdb`

Manage the default encoding when database initialization is managed by the package
Expand Down
45 changes: 27 additions & 18 deletions manifests/server/instance/initdb.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -190,6 +197,8 @@
user => $user,
group => $group,
module_workdir => $module_workdir,
psql_path => $psql_path,
port => $port,
}
}
}