Puppet Class: postgresql::server

Inherits:
postgresql::params
Defined in:
manifests/server.pp

Summary

This installs a PostgreSQL server

Overview

Parameters:

  • postgres_password (Optional[Variant[String[1], Sensitive[String[1]], Integer]]) (defaults to: undef)

    Sets the password for the postgres user to your specified value. By default, this setting uses the superuser account in the Postgres database, with a user called postgres and no password.

  • package_name (Any) (defaults to: $postgresql::params::server_package_name)

    Specifies the name of the package to use for installing the server software.

  • package_ensure (Any) (defaults to: $postgresql::params::package_ensure)

    Passes a value through to the package resource when creating the server instance.

  • plperl_package_name (Any) (defaults to: $postgresql::params::plperl_package_name)

    Sets the default package name for the PL/Perl extension.

  • plpython_package_name (Any) (defaults to: $postgresql::params::plpython_package_name)

    Sets the default package name for the PL/Python extension.

  • service_ensure (Any) (defaults to: $postgresql::params::service_ensure)

    Ensure service is installed

  • service_enable (Any) (defaults to: $postgresql::params::service_enable)

    Enable the PostgreSQL service

  • service_manage (Any) (defaults to: $postgresql::params::service_manage)

    Defines whether or not Puppet should manage the service.

  • service_name (Any) (defaults to: $postgresql::params::service_name)

    Overrides the default PostgreSQL service name.

  • service_restart_on_change (Any) (defaults to: $postgresql::params::service_restart_on_change)

    Overrides the default behavior to restart your PostgreSQL service when a config entry has been changed that requires a service restart to become active.

  • service_provider (Any) (defaults to: $postgresql::params::service_provider)

    Overrides the default PostgreSQL service provider.

  • service_reload (Any) (defaults to: $postgresql::params::service_reload)

    Overrides the default reload command for your PostgreSQL service.

  • service_status (Any) (defaults to: $postgresql::params::service_status)

    Overrides the default status check command for your PostgreSQL service.

  • default_database (Any) (defaults to: $postgresql::params::default_database)

    Specifies the name of the default database to connect with. On most systems this is ‘postgres’.

  • default_connect_settings (Any) (defaults to: $postgresql::globals::default_connect_settings)

    Specifies a hash of environment variables used when connecting to a remote server. Becomes the default for other defined types, such as postgresql::server::role.

  • listen_addresses (Any) (defaults to: $postgresql::params::listen_addresses)

    Address list on which the PostgreSQL service will listen

  • port (Any) (defaults to: $postgresql::params::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: 5432. Meaning the Postgres server listens on TCP port 5432.

  • ip_mask_deny_postgres_user (Any) (defaults to: $postgresql::params::ip_mask_deny_postgres_user)

    Specifies the IP mask from which remote connections should be denied for the postgres superuser. Default value: ‘0.0.0.0/0’, which denies any remote connection.

  • ip_mask_allow_all_users (Any) (defaults to: $postgresql::params::ip_mask_allow_all_users)

    Overrides PostgreSQL defaults for remote connections. By default, PostgreSQL does not allow database user accounts to connect via TCP from remote machines. If you’d like to allow this, you can override this setting. Set to ‘0.0.0.0/0’ to allow database users to connect from any remote machine, or ‘192.168.0.0/1’ to allow connections from any machine on your local ‘192.168’ subnet. Default value: ‘127.0.0.1/32’.

  • ipv4acls (Array[String[1]]) (defaults to: $postgresql::params::ipv4acls)

    Lists strings for access control for connection method, users, databases, IPv4 addresses;

  • ipv6acls (Array[String[1]]) (defaults to: $postgresql::params::ipv6acls)

    Lists strings for access control for connection method, users, databases, IPv6 addresses.

  • initdb_path (Any) (defaults to: $postgresql::params::initdb_path)

    Specifies the path to the initdb command.

  • createdb_path (Any) (defaults to: $postgresql::params::createdb_path)

    Deprecated. Specifies the path to the createdb command.

  • psql_path (Any) (defaults to: $postgresql::params::psql_path)

    Specifies the path to the psql command.

  • pg_hba_conf_path (Any) (defaults to: $postgresql::params::pg_hba_conf_path)

    Specifies the path to your pg_hba.conf file.

  • pg_ident_conf_path (Any) (defaults to: $postgresql::params::pg_ident_conf_path)

    Specifies the path to your pg_ident.conf file.

  • postgresql_conf_path (Any) (defaults to: $postgresql::params::postgresql_conf_path)

    Specifies the path to your postgresql.conf file.

  • postgresql_conf_mode (Optional[Stdlib::Filemode]) (defaults to: $postgresql::params::postgresql_conf_mode)

    Sets the mode of your postgresql.conf file. Only relevant if manage_postgresql_conf_perms is true.

  • recovery_conf_path (Any) (defaults to: $postgresql::params::recovery_conf_path)

    Specifies the path to your recovery.conf file.

  • datadir (Any) (defaults to: $postgresql::params::datadir)

    PostgreSQL data directory

  • xlogdir (Any) (defaults to: $postgresql::params::xlogdir)

    PostgreSQL xlog directory

  • logdir (Any) (defaults to: $postgresql::params::logdir)

    PostgreSQL log directory

  • log_line_prefix (Any) (defaults to: $postgresql::params::log_line_prefix)

    PostgreSQL log line prefix

  • pg_hba_conf_defaults (Any) (defaults to: $postgresql::params::pg_hba_conf_defaults)

    If false, disables the defaults supplied with the module for pg_hba.conf. This is useful if you disagree with the defaults and wish to override them yourself. Be sure that your changes of course align with the rest of the module, as some access is required to perform basic psql operations for example.

  • user (Any) (defaults to: $postgresql::params::user)

    Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system.

  • group (Any) (defaults to: $postgresql::params::group)

    Overrides the default postgres user group to be used for related files in the file system.

  • needs_initdb (Any) (defaults to: $postgresql::params::needs_initdb)

    Explicitly calls the initdb operation after server package is installed, and before the PostgreSQL service is started.

  • encoding (Any) (defaults to: $postgresql::params::encoding)

    Sets the default encoding for all databases created with this module. On certain operating systems this is also used during the template1 initialization, so it becomes a default outside of the module as well.

  • locale (Any) (defaults to: $postgresql::params::locale)

    Sets the default database locale for all databases created with this module. On certain operating systems this is used during the template1 initialization as well, so it becomes a default outside of the module.

  • data_checksums (Any) (defaults to: $postgresql::params::data_checksums)

    Boolean. Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Warning: This option is used during initialization by initdb, and cannot be changed later. If set, checksums are calculated for all objects, in all databases.

  • timezone (Any) (defaults to: $postgresql::params::timezone)

    Set timezone for the PostgreSQL instance

  • manage_pg_hba_conf (Any) (defaults to: $postgresql::params::manage_pg_hba_conf)

    Boolean. Whether to manage the pg_hba.conf.

  • manage_pg_ident_conf (Any) (defaults to: $postgresql::params::manage_pg_ident_conf)

    Boolean. Overwrites the pg_ident.conf file.

  • manage_recovery_conf (Any) (defaults to: $postgresql::params::manage_recovery_conf)

    Boolean. Specifies whether or not manage the recovery.conf.

  • manage_postgresql_conf_perms (Boolean) (defaults to: $postgresql::params::manage_postgresql_conf_perms)

    Whether to manage the postgresql conf file permissions. This means owner, group and mode. Contents are not managed but should be managed through postgresql::server::config_entry.

  • module_workdir (Any) (defaults to: $postgresql::params::module_workdir)

    Working directory for the PostgreSQL module

  • manage_datadir (Any) (defaults to: $postgresql::params::manage_datadir)

    Set to false if you have file{ $datadir: } already defined

  • manage_logdir (Any) (defaults to: $postgresql::params::manage_logdir)

    Set to false if you have file{ $logdir: } already defined

  • manage_xlogdir (Any) (defaults to: $postgresql::params::manage_xlogdir)

    Set to false if you have file{ $xlogdir: } already defined

  • roles (Hash[String, Hash]) (defaults to: {})

    Specifies a hash from which to generate postgresql::server::role resources.

  • config_entries (Hash[String, Any]) (defaults to: {})

    Specifies a hash from which to generate postgresql::server::config_entry resources.

  • pg_hba_rules (Hash[String, Hash]) (defaults to: {})

    Specifies a hash from which to generate postgresql::server::pg_hba_rule resources.

  • version (Any) (defaults to: undef)

    Deprecated. Use postgresql::globals instead. Sets PostgreSQL version

  • extra_systemd_config (Any) (defaults to: $postgresql::params::extra_systemd_config)

    Adds extra config to systemd config file, can for instance be used to add extra openfiles. This can be a multi line string

  • manage_selinux (Boolean) (defaults to: $postgresql::params::manage_selinux)
  • password_encryption (Any) (defaults to: $postgresql::params::password_encryption)


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'manifests/server.pp', line 85

class postgresql::server (
  Optional[Variant[String[1], Sensitive[String[1]], Integer]] $postgres_password = undef,

  $package_name                                    = $postgresql::params::server_package_name,
  $package_ensure                                  = $postgresql::params::package_ensure,

  $plperl_package_name                             = $postgresql::params::plperl_package_name,
  $plpython_package_name                           = $postgresql::params::plpython_package_name,

  $service_ensure                                  = $postgresql::params::service_ensure,
  $service_enable                                  = $postgresql::params::service_enable,
  $service_manage                                  = $postgresql::params::service_manage,
  $service_name                                    = $postgresql::params::service_name,
  $service_restart_on_change                       = $postgresql::params::service_restart_on_change,
  $service_provider                                = $postgresql::params::service_provider,
  $service_reload                                  = $postgresql::params::service_reload,
  $service_status                                  = $postgresql::params::service_status,
  $default_database                                = $postgresql::params::default_database,
  $default_connect_settings                        = $postgresql::globals::default_connect_settings,
  $listen_addresses                                = $postgresql::params::listen_addresses,
  $port                                            = $postgresql::params::port,
  $ip_mask_deny_postgres_user                      = $postgresql::params::ip_mask_deny_postgres_user,
  $ip_mask_allow_all_users                         = $postgresql::params::ip_mask_allow_all_users,
  Array[String[1]] $ipv4acls                       = $postgresql::params::ipv4acls,
  Array[String[1]] $ipv6acls                       = $postgresql::params::ipv6acls,

  $initdb_path                                     = $postgresql::params::initdb_path,
  $createdb_path                                   = $postgresql::params::createdb_path,
  $psql_path                                       = $postgresql::params::psql_path,
  $pg_hba_conf_path                                = $postgresql::params::pg_hba_conf_path,
  $pg_ident_conf_path                              = $postgresql::params::pg_ident_conf_path,
  $postgresql_conf_path                            = $postgresql::params::postgresql_conf_path,
  Optional[Stdlib::Filemode] $postgresql_conf_mode = $postgresql::params::postgresql_conf_mode,
  $recovery_conf_path                              = $postgresql::params::recovery_conf_path,

  $datadir                                         = $postgresql::params::datadir,
  $xlogdir                                         = $postgresql::params::xlogdir,
  $logdir                                          = $postgresql::params::logdir,

  $log_line_prefix                                 = $postgresql::params::log_line_prefix,

  $pg_hba_conf_defaults                            = $postgresql::params::pg_hba_conf_defaults,

  $user                                            = $postgresql::params::user,
  $group                                           = $postgresql::params::group,

  $needs_initdb                                    = $postgresql::params::needs_initdb,

  $encoding                                        = $postgresql::params::encoding,
  $locale                                          = $postgresql::params::locale,
  $data_checksums                                  = $postgresql::params::data_checksums,
  $timezone                                        = $postgresql::params::timezone,

  $manage_pg_hba_conf                              = $postgresql::params::manage_pg_hba_conf,
  $manage_pg_ident_conf                            = $postgresql::params::manage_pg_ident_conf,
  $manage_recovery_conf                            = $postgresql::params::manage_recovery_conf,
  Boolean $manage_postgresql_conf_perms            = $postgresql::params::manage_postgresql_conf_perms,
  Boolean $manage_selinux                          = $postgresql::params::manage_selinux,
  $module_workdir                                  = $postgresql::params::module_workdir,

  $manage_datadir                                  = $postgresql::params::manage_datadir,
  $manage_logdir                                   = $postgresql::params::manage_logdir,
  $manage_xlogdir                                  = $postgresql::params::manage_xlogdir,
  $password_encryption                             = $postgresql::params::password_encryption,
  $extra_systemd_config                            = $postgresql::params::extra_systemd_config,

  Hash[String, Hash] $roles         = {},
  Hash[String, Any] $config_entries = {},
  Hash[String, Hash] $pg_hba_rules  = {},

  #Deprecated
  $version                    = undef,
) inherits postgresql::params {
  if $version != undef {
    warning('Passing "version" to postgresql::server is deprecated; please use postgresql::globals instead.')
    $_version = $version
  } else {
    $_version = $postgresql::params::version
  }

  if $createdb_path != undef {
    warning('Passing "createdb_path" to postgresql::server is deprecated, it can be removed safely for the same behaviour')
  }

  # Reload has its own ordering, specified by other defines
  class { 'postgresql::server::reload':
    require => Class['postgresql::server::install'],
  }

  contain postgresql::server::install
  contain postgresql::server::initdb
  contain postgresql::server::config
  contain postgresql::server::service
  contain postgresql::server::passwd

  Class['postgresql::server::install']
  -> Class['postgresql::server::initdb']
  -> Class['postgresql::server::config']
  -> Class['postgresql::server::service']
  -> Class['postgresql::server::passwd']

  $roles.each |$rolename, $role| {
    postgresql::server::role { $rolename:
      * => $role,
    }
  }

  $config_entries.each |$entry, $value| {
    postgresql::server::config_entry { $entry:
      ensure => bool2str($value =~ Undef, 'absent', 'present'),
      value  => $value,
    }
  }

  $pg_hba_rules.each |$rule_name, $rule| {
    postgresql::server::pg_hba_rule { $rule_name:
      * => $rule,
    }
  }
}