diff --git a/README.md b/README.md index ab6adf3..d27dc52 100644 --- a/README.md +++ b/README.md @@ -1,2193 +1,1959 @@ # postgresql #### Table of Contents 1. [Module Description - What does the module do?](#module-description) 2. [Setup - The basics of getting started with postgresql module](#setup) * [What postgresql affects](#what-postgresql-affects) * [Getting started with postgresql](#getting-started-with-postgresql) 3. [Usage - Configuration options and additional functionality](#usage) * [Configure a server](#configure-a-server) * [Create a database](#create-a-database) * [Manage users, roles, and permissions](#manage-users-roles-and-permissions) * [Manage ownership of DB objects](#manage-ownership-of-db-objects) * [Override defaults](#override-defaults) * [Create an access rule for pg_hba.conf](#create-an-access-rule-for-pg_hbaconf) * [Create user name maps for pg_ident.conf](#create-user-name-maps-for-pg_identconf) * [Validate connectivity](#validate-connectivity) 4. [Reference - An under-the-hood peek at what the module is doing and how](#reference) * [Classes](#classes) * [Defined Types](#defined-types) * [Types](#types) * [Functions](#functions) * [Tasks](#tasks) 5. [Limitations - OS compatibility, etc.](#limitations) 6. [Development - Guide for contributing to the module](#development) * [Contributors - List of module contributors](#contributors) 7. [Tests](#tests) 8. [Contributors - List of module contributors](#contributors) ## Module description The postgresql module allows you to manage PostgreSQL databases with Puppet. -PostgreSQL is a high-performance, free, open-source relational database server. -The postgresql module allows you to manage packages, services, databases, -users, and common security settings in PostgreSQL. +PostgreSQL is a high-performance, free, open-source relational database server. The postgresql module allows you to manage packages, services, databases, users, and common security settings in PostgreSQL. ## Setup ### What postgresql affects * Package, service, and configuration files for PostgreSQL * Listened-to ports * IP and mask (optional) ### Getting started with postgresql -To configure a basic default PostgreSQL server, declare -the `postgresql::server` class. +To configure a basic default PostgreSQL server, declare the `postgresql::server` class. ```puppet class { 'postgresql::server': } ``` ## Usage ### Configure a server -For default settings, declare the `postgresql::server` class as above. -To customize PostgreSQL server settings, specify -[the parameters](#postgresqlserver) you want to change: +For default settings, declare the `postgresql::server` class as above. To customize PostgreSQL server settings, specify the [parameters](#postgresqlserver) you want to change: ```puppet class { 'postgresql::server': ip_mask_deny_postgres_user => '0.0.0.0/32', ip_mask_allow_all_users => '0.0.0.0/0', ipv4acls => ['hostssl all johndoe 192.168.0.0/24 cert'], postgres_password => 'TPSrep0rt!', } ``` After configuration, test your settings from the command line: ```shell psql -h localhost -U postgres psql -h my.postgres.server -U ``` -If you get an error message from these commands, your permission settings -restrict access from the location you're trying to connect from. Depending -on whether you want to allow connections from that location, you might need -to adjust your permissions. +If you get an error message from these commands, your permission settings restrict access from the location you're trying to connect from. Depending on whether you want to allow connections from that location, you might need to adjust your permissions. -For more details about server configuration parameters, consult -[the PostgreSQL Runtime Configuration documentation](http://www.postgresql.org/docs/current/static/runtime-config.html). +For more details about server configuration parameters, consult the [PostgreSQL Runtime Configuration documentation](http://www.postgresql.org/docs/current/static/runtime-config.html). ### Create a database -You can set up a variety of PostgreSQL databases with -the `postgresql::server::db` defined type. For instance, to set up a database -for PuppetDB: +You can set up a variety of PostgreSQL databases with the `postgresql::server::db` defined type. For instance, to set up a database for PuppetDB: ```puppet class { 'postgresql::server': } postgresql::server::db { 'mydatabasename': user => 'mydatabaseuser', password => postgresql_password('mydatabaseuser', 'mypassword'), } ``` ### Manage users, roles, and permissions To manage users, roles, and permissions: ```puppet class { 'postgresql::server': } postgresql::server::role { 'marmot': password_hash => postgresql_password('marmot', 'mypasswd'), } postgresql::server::database_grant { 'test1': privilege => 'ALL', db => 'test1', role => 'marmot', } postgresql::server::table_grant { 'my_table of test2': privilege => 'ALL', table => 'my_table', db => 'test2', role => 'marmot', } ``` -This example grants **all** privileges on the `test1` database and on -the `my_table` table of the `test2` database to the specified user or group. -After the values are added into the PuppetDB config file, this database would -be ready for use. +This example grants **all** privileges on the test1 database and on the `my_table` table of the test2 database to the specified user or group. After the values are added into the PuppetDB config file, this database would be ready for use. ### Manage ownership of DB objects -To change the ownership of all objects within a database using -`REASSIGN OWNED`: +To change the ownership of all objects within a database using REASSIGN OWNED: ```puppet postgresql::server::reassign_owned_by { 'new owner is meerkat': db => 'test_db', old_role => 'marmot', new_role => 'meerkat', } ``` -This would run the PostgreSQL statement `REASSIGN OWNED` to update to ownership -of all tables, sequences, functions and views currently owned by -the role `marmot` to be owned by the role `meerkat` instead. +This would run the PostgreSQL statement 'REASSIGN OWNED' to update to ownership of all tables, sequences, functions and views currently owned by the role 'marmot' to be owned by the role 'meerkat' instead. -This applies to objects within the nominated database, `test_db` only. +This applies to objects within the nominated database, 'test_db' only. -For PostgreSQL >= 9.3, the ownership of the database is also updated. +For Postgresql >= 9.3, the ownership of the database is also updated. ### Override defaults -The `postgresql::globals` class allows you to configure the main settings -for this module globally, so that other classes and defined resources can use -them. By itself, it does nothing. +The `postgresql::globals` class allows you to configure the main settings for this module globally, so that other classes and defined resources can use them. By itself, it does nothing. -For example, to overwrite the default `locale` and `encoding` for all classes, -use the following: +For example, to overwrite the default `locale` and `encoding` for all classes, use the following: ```puppet class { 'postgresql::globals': encoding => 'UTF-8', locale => 'en_US.UTF-8', } class { 'postgresql::server': } ``` To use a specific version of the PostgreSQL package: ```puppet class { 'postgresql::globals': manage_package_repo => true, version => '9.2', } class { 'postgresql::server': } ``` ### Manage remote users, roles, and permissions -Remote SQL objects are managed using the same Puppet resources as local -SQL objects, along with a [`connect_settings`](#connect_settings) hash. -This provides control over how Puppet connects to the remote PostgreSQL -instances and which version is used for generating SQL commands. +Remote SQL objects are managed using the same Puppet resources as local SQL objects, along with a [`connect_settings`](#connect_settings) hash. This provides control over how Puppet connects to the remote Postgres instances and which version is used for generating SQL commands. -The `connect_settings` hash can contain environment variables to control -PostgreSQL client connections, such as `PGHOST`, `PGPORT`, `PGPASSWORD`, -and `PGSSLKEY`. See -[the PostgreSQL Environment Variables documentation](http://www.postgresql.org/docs/9.4/static/libpq-envars.html) -for a complete list of variables. +The `connect_settings` hash can contain environment variables to control Postgres client connections, such as 'PGHOST', 'PGPORT', 'PGPASSWORD', and 'PGSSLKEY'. See the [PostgreSQL Environment Variables](http://www.postgresql.org/docs/9.4/static/libpq-envars.html) documentation for a complete list of variables. -Additionally, you can specify the target database version with the special -value of `DBVERSION`. If the `connect_settings` hash is omitted or empty, -then Puppet connects to the local PostgreSQL instance. +Additionally, you can specify the target database version with the special value of 'DBVERSION'. If the `connect_settings` hash is omitted or empty, then Puppet connects to the local PostgreSQL instance. -You can provide a `connect_settings` hash for each of the Puppet resources, -or you can set a default `connect_settings` hash in `postgresql::globals`. -Configuring `connect_settings` per resource allows SQL objects to be created -on multiple databases by multiple users. +You can provide a `connect_settings` hash for each of the Puppet resources, or you can set a default `connect_settings` hash in `postgresql::globals`. Configuring `connect_settings` per resource allows SQL objects to be created on multiple databases by multiple users. ```puppet $connection_settings_super2 = { 'PGUSER' => 'super2', 'PGPASSWORD' => 'foobar2', 'PGHOST' => '127.0.0.1', 'PGPORT' => '5432', 'PGDATABASE' => 'postgres', } include postgresql::server # Connect with no special settings, i.e domain sockets, user postgres postgresql::server::role { 'super2': password_hash => 'foobar2', superuser => true, connect_settings => {}, } # Now using this new user connect via TCP postgresql::server::database { 'db1': connect_settings => $connection_settings_super2, require => Postgresql::Server::Role['super2'], } ``` ### Create an access rule for pg_hba.conf To create an access rule for `pg_hba.conf`: ```puppet postgresql::server::pg_hba_rule { 'allow application network to access app database': description => 'Open up PostgreSQL for access from 200.1.2.0/24', type => 'host', database => 'app', user => 'app', address => '200.1.2.0/24', auth_method => 'md5', } ``` This would create a ruleset in `pg_hba.conf` similar to: ``` # Rule Name: allow application network to access app database # Description: Open up PostgreSQL for access from 200.1.2.0/24 # Order: 150 host app app 200.1.2.0/24 md5 ``` -By default, `pg_hba_rule` requires that you include `postgresql::server`. -However, you can override that behavior by setting target and -postgresql_version when declaring your rule. That might look like -the following: +By default, `pg_hba_rule` requires that you include `postgresql::server`. However, you can override that behavior by setting target and postgresql_version when declaring your rule. That might look like the following: ```puppet postgresql::server::pg_hba_rule { 'allow application network to access app database': description => 'Open up postgresql for access from 200.1.2.0/24', type => 'host', database => 'app', user => 'app', address => '200.1.2.0/24', auth_method => 'md5', target => '/path/to/pg_hba.conf', postgresql_version => '9.4', } ``` ### Create user name maps for pg_ident.conf To create a user name map for the pg_ident.conf: ```puppet postgresql::server::pg_ident_rule { 'Map the SSL certificate of the backup server as a replication user': map_name => 'sslrepli', system_username => 'repli1.example.com', database_username => 'replication', } ``` This would create a user name map in `pg_ident.conf` similar to: ``` #Rule Name: Map the SSL certificate of the backup server as a replication user #Description: none #Order: 150 sslrepli repli1.example.com replication ``` ### Create recovery configuration To create the recovery configuration file (`recovery.conf`): ```puppet postgresql::server::recovery { 'Create a recovery.conf file with the following defined parameters': restore_command => 'cp /mnt/server/archivedir/%f %p', archive_cleanup_command => undef, recovery_end_command => undef, recovery_target_name => 'daily backup 2015-01-26', recovery_target_time => '2015-02-08 22:39:00 EST', recovery_target_xid => undef, recovery_target_inclusive => true, recovery_target => 'immediate', recovery_target_timeline => 'latest', pause_at_recovery_target => true, standby_mode => 'on', primary_conninfo => 'host=localhost port=5432', primary_slot_name => undef, trigger_file => undef, recovery_min_apply_delay => 0, } ``` The above creates this `recovery.conf` config file: ``` restore_command = 'cp /mnt/server/archivedir/%f %p' recovery_target_name = 'daily backup 2015-01-26' recovery_target_time = '2015-02-08 22:39:00 EST' recovery_target_inclusive = true recovery_target = 'immediate' recovery_target_timeline = 'latest' pause_at_recovery_target = true standby_mode = 'on' primary_conninfo = 'host=localhost port=5432' recovery_min_apply_delay = 0 ``` -Only the specified parameters are recognized in the template. -The `recovery.conf` is only be created if at least one parameter is set -**and** [manage_recovery_conf](#manage_recovery_conf) is set to true. +Only the specified parameters are recognized in the template. The `recovery.conf` is only be created if at least one parameter is set **and** [manage_recovery_conf](#manage_recovery_conf) is set to true. ### Validate connectivity -To validate client connections to a remote PostgreSQL database before starting -dependent tasks, use the `postgresql_conn_validator` resource. You can use -this on any node where the PostgreSQL client package is installed. It is -often chained to other tasks such as starting an application server or -performing a database migration. +To validate client connections to a remote PostgreSQL database before starting dependent tasks, use the `postgresql_conn_validator` resource. You can use this on any node where the PostgreSQL client software is installed. It is often chained to other tasks such as starting an application server or performing a database migration. Example usage: ```puppet postgresql_conn_validator { 'validate my postgres connection': host => 'my.postgres.host', db_username => 'mydbuser', db_password => 'mydbpassword', db_name => 'mydbname', }-> exec { 'rake db:migrate': cwd => '/opt/myrubyapp', } ``` ## Reference -The postgresql module comes with many options for configuring the server. -While you are unlikely to use all of the settings below, they provide a decent -amount of control over your security settings. +The postgresql module comes with many options for configuring the server. While you are unlikely to use all of the settings below, they provide a decent amount of control over your security settings. **Classes:** * [postgresql::client](#postgresqlclient) * [postgresql::globals](#postgresqlglobals) * [postgresql::lib::devel](#postgresqllibdevel) * [postgresql::lib::java](#postgresqllibjava) * [postgresql::lib::perl](#postgresqllibperl) * [postgresql::lib::python](#postgresqllibpython) * [postgresql::server](#postgresqlserver) * [postgresql::server::plperl](#postgresqlserverplperl) * [postgresql::server::contrib](#postgresqlservercontrib) * [postgresql::server::postgis](#postgresqlserverpostgis) **Defined Types:** * [postgresql::server::config_entry](#postgresqlserverconfig_entry) * [postgresql::server::database](#postgresqlserverdatabase) * [postgresql::server::database_grant](#postgresqlserverdatabase_grant) * [postgresql::server::db](#postgresqlserverdb) * [postgresql::server::extension](#postgresqlserverextension) * [postgresql::server::grant](#postgresqlservergrant) * [postgresql::server::grant_role](#postgresqlservergrant_role) * [postgresql::server::pg_hba_rule](#postgresqlserverpg_hba_rule) * [postgresql::server::pg_ident_rule](#postgresqlserverpg_ident_rule) * [postgresql::server::reassign_owned_by](#postgresqlserverreassign_owned_by) * [postgresql::server::recovery](#postgresqlserverrecovery) * [postgresql::server::role](#postgresqlserverrole) * [postgresql::server::schema](#postgresqlserverschema) * [postgresql::server::table_grant](#postgresqlservertable_grant) * [postgresql::server::tablespace](#postgresqlservertablespace) **Types:** * [postgresql_psql](#custom-resource-postgresql_psql) * [postgresql_replication_slot](#custom-resource-postgresql_replication_slot) * [postgresql_conf](#custom-resource-postgresql_conf) * [postgresql_conn_validator](#custom-resource-postgresql_conn_validator) **Functions:** * [postgresql_password](#function-postgresql_password) * [postgresql_acls_to_resources_hash](#function-postgresql_acls_to_resources_hashacl_array-id-order_offset) **Tasks:** * [`sql`](#tasks) ### Classes #### postgresql::client -Installs PostgreSQL client package. Set the following parameters if you have -a custom version you would like to install. +Installs PostgreSQL client software. Set the following parameters if you have a custom version you would like to install. -**Note:** Make sure to add any necessary yum or apt repositories if specifying -a custom version. +>**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version. ##### `package_ensure` Whether the PostgreSQL client package resource should be present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. ##### `package_name` Sets the name of the PostgreSQL client package. -Default value: `file`. +Default value: 'file'. #### postgresql::lib::docs -Installs PostgreSQL documentation package. Set the following parameters -if you have a custom version you would like to install. +Installs PostgreSQL bindings for Postgres-Docs. Set the following parameters if you have a custom version you would like to install. -**Note:** Make sure to add any necessary yum or apt repositories if specifying -a custom version. +**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version. ##### `package_name` Specifies the name of the PostgreSQL docs package. ##### `package_ensure` Whether the PostgreSQL docs package resource should be present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. #### postgresql::globals -**Note:** Most server-specific defaults should be overridden in -the `postgresql::server` class. This class should be used only if you are -using a non-standard OS, or if you are changing elements that can only be -changed here, such as `version` or `manage_package_repo`. +**Note:** Most server-specific defaults should be overridden in the `postgresql::server` class. This class should be used only if you are using a non-standard OS, or if you are changing elements that can only be changed here, such as `version` or `manage_package_repo`. ##### `bindir` Overrides the default PostgreSQL binaries directory for the target platform. Default value: OS dependent. ##### `client_package_name` Overrides the default PostgreSQL client package name. Default value: OS dependent. ##### `confdir` -Overrides the default PostgreSQL configuration directory for the target -platform. +Overrides the default PostgreSQL configuration directory for the target platform. Default value: OS dependent. ##### `contrib_package_name` Overrides the default PostgreSQL contrib package name. Default value: OS dependent. ##### `createdb_path` -**Deprecated.** +**Deprecated.** Path to the `createdb` command. -Path to the `createdb` command. - -Default value: `${bindir}/createdb`. +Default value: '${bindir}/createdb'. ##### `datadir` Overrides the default PostgreSQL data directory for the target platform. Default value: OS dependent. -**Note:** Changing the `datadir` after installation causes the server to come -to a full stop before making the change. For Red Hat systems, the data -directory must be labeled appropriately for SELinux. On Ubuntu, you must -explicitly set `needs_initdb = true` to allow Puppet to initialize the database -in the new `datadir` (`needs_initdb` defaults to true on other systems). +**Note:** Changing the datadir after installation causes the server to come to a full stop before making the change. For Red Hat systems, the data directory must be labeled appropriately for SELinux. On Ubuntu, you must explicitly set `needs_initdb = true` to allow Puppet to initialize the database in the new datadir (`needs_initdb` defaults to true on other systems). -**Warning:** If `datadir` is changed from the default, Puppet does not manage -purging of the original data directory, which causes it to fail if the data -directory is changed back to the original. +**Warning:** If datadir is changed from the default, Puppet does not manage purging of the original data directory, which causes it to fail if the data directory is changed back to the original. ##### `data_checksums` Optional. -Use checksums on data pages to help detect corruption by the I/O system that -would otherwise be silent. +Data type: Boolean. + +Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Valid values: `true` or `false`. -Default: `initdb`'s default (`false`). +Default: initdb's default (`false`). -**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. +**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. ##### `default_database` Specifies the name of the default database to connect with. -Default value: `postgres` (for most systems). +Default value: 'postgres' (for most systems). ##### `devel_package_name` Overrides the default PostgreSQL devel package name. Default value: OS dependent. ##### `docs_package_name` Optional. Overrides the default PostgreSQL docs package name. Default value: OS dependent. ##### `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. +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. -Default value: dependent on the operating system's default encoding. +Default value: Dependent on the operating system's default encoding. ##### `group` -Overrides the default postgres user group to be used for related files in -the file system. +Overrides the default postgres user group to be used for related files in the file system. -Default value: `postgres`. +Default value: 'postgres'. ##### `initdb_path` Path to the `initdb` command. ##### `java_package_name` -Overrides the default PostgreSQL Java package name. +Overrides the default PostgreSQL java package name. Default value: OS dependent. ##### `locale` -Sets the default database locale 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. +Sets the default database locale 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. -Default value: `undef`, which is effectively `"C"`. +Default value: `undef`, which is effectively 'C'. -**Warning:** On Debian, you'll need to ensure that the `locales-all` package is -installed for full functionality of PostgreSQL. +**On Debian, you'll need to ensure that the 'locales-all' package is installed for full functionality of PostgreSQL.** ##### `timezone` -Sets the default timezone of the postgresql server. The postgresql built-in -default is taking the systems timezone information. +Sets the default timezone of the postgresql server. The postgresql built-in default is taking the systems timezone information. ##### `logdir` Overrides the default PostgreSQL log directory. -Default value: `initdb`'s default path. +Default value: initdb's default path. ##### `manage_package_repo` Sets up official PostgreSQL repositories on your host if set to `true`. Default value: `false`. ##### `module_workdir` -Specifies working directory under which the `psql` command should be executed. -May need to specify if `/tmp` is on volume mounted with `noexec` option. +Specifies working directory under which the psql command should be executed. May need to specify if '/tmp' is on volume mounted with noexec option. -Default value: `/tmp`. +Default value: '/tmp'. ##### `needs_initdb` -Explicitly calls the `initdb` operation after the server package is installed -and before the PostgreSQL service is started. +Explicitly calls the initdb operation after the server package is installed and before the PostgreSQL service is started. Default value: OS dependent. ##### `perl_package_name` Overrides the default PostgreSQL Perl package name. Default value: OS dependent. ##### `pg_hba_conf_defaults` -Disables the defaults supplied with the module for `pg_hba.conf` if set to -`false`. This is useful if you want to override the defaults. Be sure that -your changes align with the rest of the module, as some access is required -to perform some operations, such as basic `psql` operations. +Disables the defaults supplied with the module for `pg_hba.conf` if set to `false`. This is useful if you want to override the defaults. Be sure that your changes align with the rest of the module, as some access is required to perform some operations, such as basic `psql` operations. -Default value: the globals value set in `postgresql::globals::manage_pg_hba_conf` -which defaults to `true`. +Default value: The globals value set in `postgresql::globals::manage_pg_hba_conf` which defaults to `true`. ##### `pg_hba_conf_path` Specifies the path to your `pg_hba.conf` file. -Default value: `${confdir}/pg_hba.conf`. +Default value: '${confdir}/pg_hba.conf'. ##### `pg_ident_conf_path` Specifies the path to your `pg_ident.conf` file. -Default value: `${confdir}/pg_ident.conf`. +Default value: '${confdir}/pg_ident.conf'. ##### `plperl_package_name` Overrides the default PostgreSQL PL/Perl package name. Default value: OS dependent. ##### `plpython_package_name` Overrides the default PostgreSQL PL/Python package name. Default value: OS dependent. ##### `postgis_version` Defines the version of PostGIS to install, if you install PostGIS. -Default value: the lowest available with the version of PostgreSQL to be -installed. +Default value: The lowest available with the version of PostgreSQL to be installed. ##### `postgresql_conf_path` Sets the path to your `postgresql.conf` file. -Default value: `${confdir}/postgresql.conf`. +Default value: '${confdir}/postgresql.conf'. ##### `psql_path` Sets the path to the `psql` command. ##### `python_package_name` Overrides the default PostgreSQL Python package name. Default value: OS dependent. ##### `recovery_conf_path` Path to your `recovery.conf` file. ##### `repo_proxy` -Sets the proxy option for the official PostgreSQL yum-repositories only. -This is useful if your server is behind a corporate firewall and needs to use -proxy servers for outside connectivity. +Sets the proxy option for the official PostgreSQL yum-repositories only. This is useful if your server is behind a corporate firewall and needs to use proxy servers for outside connectivity. Debian is currently not supported. ##### `repo_baseurl` -Sets the baseurl for the PostgreSQL repository. Useful if you host your own -mirror of the repository. +Sets the baseurl for the PostgreSQL repository. Useful if you host your own mirror of the repository. -Default value: the official PostgreSQL repository. +Default value: The official PostgreSQL repository. ##### `server_package_name` Overrides the default PostgreSQL server package name. Default value: OS dependent. ##### `service_name` Overrides the default PostgreSQL service name. Default value: OS dependent. ##### `service_provider` Overrides the default PostgreSQL service provider. Default value: OS dependent. ##### `service_status` Overrides the default status check command for your PostgreSQL service. Default value: OS dependent. ##### `user` -Overrides the default PostgreSQL super user and owner of PostgreSQL related -files in the file system. +Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system. -Default value: `postgres`. +Default value: 'postgres'. ##### `version` The version of PostgreSQL to install and manage. Default value: OS system default. ##### `xlogdir` Overrides the default PostgreSQL xlog directory. Default value: initdb's default path. #### postgresql::lib::devel -Installs the packages containing the development libraries for PostgreSQL and -symlinks `pg_config` into `/usr/bin` (if not in `/usr/bin` or `/usr/local/bin`). +Installs the packages containing the development libraries for PostgreSQL and symlinks `pg_config` into `/usr/bin` (if not in `/usr/bin` or `/usr/local/bin`). ##### `link_pg_config` -If the bin directory used by the PostgreSQL page is not `/usr/bin` or -`/usr/local/bin`, symlinks `pg_config` from the package's bin directory into -`usr/bin` (not applicable to Debian systems). Set to `false` to disable -this behavior. +If the bin directory used by the PostgreSQL page is not `/usr/bin` or `/usr/local/bin`, symlinks `pg_config` from the package's bin dir into `usr/bin` (not applicable to Debian systems). Set to `false` to disable this behavior. Valid values: `true`, `false`. Default value: `true`. ##### `package_ensure` -Overrides the `ensure` parameter during package installation. +Overrides the 'ensure' parameter during package installation. -Default value: `present`. +Default value: 'present'. ##### `package_name` Overrides the default package name for the distribution you are installing to. -Default value: `postgresql-devel` or `postgresql-devel` depending on -your OS. +Default value: 'postgresql-devel' or 'postgresql-devel' depending on your distro. #### postgresql::lib::java -Installs PostgreSQL bindings for Java (JDBC). Set the following parameters -if you have a custom version you would like to install. +Installs PostgreSQL bindings for Java (JDBC). Set the following parameters if you have a custom version you would like to install. -**Note:** Make sure to add any necessary yum or apt repositories if specifying -a custom version. +**Note:** Make sure to add any necessary yum or apt repositories if specifying a custom version. ##### `package_ensure` Specifies whether the package is present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. ##### `package_name` Specifies the name of the PostgreSQL java package. #### postgresql::lib::perl Installs the PostgreSQL Perl libraries. ##### `package_ensure` Specifies whether the package is present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. ##### `package_name` Specifies the name of the PostgreSQL perl package to install. #### postgresql::server::plpython Installs the PL/Python procedural language for PostgreSQL. ##### `package_name` Specifies the name of the postgresql PL/Python package. ##### `package_ensure` Specifies whether the package is present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. #### postgresql::lib::python Installs PostgreSQL Python libraries. ##### `package_ensure` Specifies whether the package is present. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. ##### `package_name` The name of the PostgreSQL Python package. #### postgresql::server ##### `createdb_path` -**Deprecated.** +**Deprecated.** Specifies the path to the `createdb` command. -Specifies the path to the `createdb` command. - -Default value: `${bindir}/createdb`. +Default value: '${bindir}/createdb'. ##### `data_checksums` Optional. -Use checksums on data pages to help detect corruption by the I/O system that -would otherwise be silent. +Data type: Boolean. + +Use checksums on data pages to help detect corruption by the I/O system that would otherwise be silent. Valid values: `true` or `false`. -Default value: `initdb`'s default (`false`). +Default value: initdb's default (`false`). -**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. +**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. ##### `default_database` -Specifies the name of the default database to connect with. On most systems -this is `postgres`. +Specifies the name of the default database to connect with. On most systems this is 'postgres'. ##### `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`. +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`. ##### `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. +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. Default value: `undef`. ##### `group` -Overrides the default postgres user group to be used for related files in -the file system. +Overrides the default postgres user group to be used for related files in the file system. -Default value: OS dependent. +Default value: OS dependent default. ##### `initdb_path` Specifies the path to the `initdb` command. -Default value: `${bindir}/initdb`. +Default value: '${bindir}/initdb'. ##### `ipv4acls` -Lists strings for access control for connection method, users, databases, IPv4 -addresses. See -[the PostgreSQL HBA documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html) -for information. +Lists strings for access control for connection method, users, databases, IPv4 addresses; + +see [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html) on `pg_hba.conf` for information. ##### `ipv6acls` -Lists strings for access control for connection method, users, databases, IPv6 -addresses. See -[the PostgreSQL HBA documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html) -for information. +Lists strings for access control for connection method, users, databases, IPv6 addresses. + +see [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html) on `pg_hba.conf` for information. ##### `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. +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. +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`. +Default value: '127.0.0.1/32'. ##### `ip_mask_deny_postgres_user` -Specifies the IP mask from which remote connections should be denied for -the postgres superuser. +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. +Default value: '0.0.0.0/0', which denies any remote connection. ##### `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. +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. -Default value: `undef`, which is effectively `"C"`. +Default value: `undef`, which is effectively 'C'. -**Warning:** On Debian, you'll need to ensure that the `locales-all` package is -installed for full functionality of PostgreSQL. +**On Debian, you must ensure that the 'locales-all' package is installed for full functionality of PostgreSQL.** ##### `manage_pg_hba_conf` Whether to manage the `pg_hba.conf`. If set to `true`, Puppet overwrites this file. If set to `false`, Puppet does not modify the file. Valid values: `true`, `false`. Default value: `true` ##### `manage_pg_ident_conf` Overwrites the pg_ident.conf file. If set to `true`, Puppet overwrites the file. If set to `false`, Puppet does not modify the file. Valid values: `true`, `false`. Default value: `true`. ##### `manage_recovery_conf` Specifies whether or not manage the `recovery.conf`. If set to `true`, Puppet overwrites this file. Valid values: `true`, `false`. Default value: `false`. ##### `needs_initdb` -Explicitly calls the `initdb` operation after server package is installed, and -before the PostgreSQL service is started. +Explicitly calls the `initdb` operation after server package is installed, and before the PostgreSQL service is started. Default value: OS dependent. ##### `package_ensure` -Passes a value through to the `package` resource when creating the server -instance. +Passes a value through to the `package` resource when creating the server instance. Default value: `undef`. ##### `package_name` -Specifies the name of the package to use for installing the PostgreSQL server. +Specifies the name of the package to use for installing the server software. Default value: OS dependent. ##### `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. +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. ##### `pg_hba_conf_path` Specifies the path to your `pg_hba.conf` file. ##### `pg_ident_conf_path` Specifies the path to your `pg_ident.conf` file. -Default value: `${confdir}/pg_ident.conf`. +Default value: '${confdir}/pg_ident.conf'. ##### `plperl_package_name` Sets the default package name for the PL/Perl extension. Default value: OS dependent. ##### `plpython_package_name` Sets the default package name for the PL/Python extension. Default value: OS dependent. ##### `port` -Specifies the port for the PostgreSQL server to listen on. +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. -**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 +Default value: 5432. Meaning the Postgres server listens on TCP port 5432. ##### `postgres_password` -Sets the password for the postgres user to your specified value. By default, -this setting uses the superuser account. +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. Default value: `undef`. ##### `postgresql_conf_path` Specifies the path to your `postgresql.conf` file. -Default value: `${confdir}/postgresql.conf`. +Default value: '${confdir}/postgresql.conf'. ##### `psql_path` Specifies the path to the `psql` command. Default value: OS dependent. ##### `service_manage` Defines whether or not Puppet should manage the service. Default value: `true`. ##### `service_name` Overrides the default PostgreSQL service name. Default value: OS dependent. ##### `service_provider` Overrides the default PostgreSQL service provider. Default value: `undef`. ##### `service_reload` Overrides the default reload command for your PostgreSQL service. Default value: OS dependent. ##### `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. +Overrides the default behavior to restart your PostgreSQL service when a config entry has been changed that requires a service restart to become active. Default value: `true`. ##### `service_status` Overrides the default status check command for your PostgreSQL service. Default value: OS dependent. ##### `user` -Overrides the default PostgreSQL super user and owner of PostgreSQL related -files in the file system. +Overrides the default PostgreSQL super user and owner of PostgreSQL related files in the file system. -Default value: `postgres`. +Default value: 'postgres'. #### postgresql::server::contrib Installs the PostgreSQL contrib package. ##### `package_ensure` Sets the ensure parameter passed on to PostgreSQL contrib package resource. ##### `package_name` The name of the PostgreSQL contrib package. #### postgresql::server::plperl Installs the PL/Perl procedural language for postgresql. ##### `package_ensure` The ensure parameter passed on to PostgreSQL PL/Perl package resource. ##### `package_name` The name of the PostgreSQL PL/Perl package. #### postgresql::server::postgis Installs the PostgreSQL postgis packages. ### Defined Types #### postgresql::server::config_entry Modifies your `postgresql.conf` configuration file. Each resource maps to a line inside the file, for example: ```puppet postgresql::server::config_entry { 'check_function_bodies': value => 'off', } ``` ##### `ensure` -Removes an entry when set to `absent`. +Removes an entry if set to 'absent'. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. ##### `value` Defines the value for the setting. #### postgresql::server::db Creates a local database, user, and assigns necessary permissions. ##### `comment` -Defines a comment to be stored about the database using the PostgreSQL COMMENT -command. +Defines a comment to be stored about the database using the PostgreSQL COMMENT command. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `dbname` Sets the name of the database to be created. Default value: the namevar. ##### `encoding` Overrides the character set during creation of the database. -Default value: the default defined during installation. +Default value: The default defined during installation. ##### `grant` Specifies the permissions to grant during creation. -Default value: `ALL`. +Default value: 'ALL'. ##### `istemplate` Specifies that the database is a template, if set to `true`. Default value: `false`. ##### `locale` Overrides the locale during creation of the database. -Default value: the default defined during installation. +Default value: The default defined during installation. ##### `owner` Sets a user as the owner of the database. -Default value: `$user` variable set in `postgresql::server` or -`postgresql::globals`. +Default value: '$user' variable set in `postgresql::server` or `postgresql::globals`. ##### `password` -Required. - -Sets the password for the created user. +**Required** Sets the password for the created user. ##### `tablespace` Defines the name of the tablespace to allocate the created database to. Default value: PostgreSQL default. ##### `template` Specifies the name of the template database from which to build this database. -Default value: `template0`. +Defaults value: `template0`. ##### `user` -Required. - -User to create and assign access to the database upon creation. +User to create and assign access to the database upon creation. Mandatory. #### postgresql::server::database Creates a database with no users and no permissions. ##### `dbname` Sets the name of the database. -Default value: the namevar. +Defaults value: The namevar. ##### `encoding` Overrides the character set during creation of the database. -Default value: the default defined during installation. +Default value: The default defined during installation. ##### `istemplate` Defines the database as a template if set to `true`. Default value: `false`. ##### `locale` Overrides the locale during creation of the database. -Default value: the default defined during installation. +Default value: The default defined during installation. ##### `owner` Sets name of the database owner. -Default value: the `$user` variable set in `postgresql::server` or -`postgresql::globals`. +Default value: The '$user' variable set in `postgresql::server` or `postgresql::globals`. ##### `tablespace` Sets tablespace for where to create this database. -Default value: the default defined during installation. +Default value: The default defined during installation. ##### `template` Specifies the name of the template database from which to build this database. -Default value: `template0`. +Default value: 'template0'. #### postgresql::server::database_grant -Manages grant-based access privileges for users, wrapping -the `postgresql::server::database_grant` for database specific permissions. -Consult -[the PostgreSQL documentation for `GRANT`](http://www.postgresql.org/docs/current/static/sql-grant.html) -for more information. +Manages grant-based access privileges for users, wrapping the `postgresql::server::database_grant` for database specific permissions. Consult the [PostgreSQL documentation for `grant`](http://www.postgresql.org/docs/current/static/sql-grant.html) for more information. ##### `ensure` Specifies whether to grant or revoke the privilege. Default is to grant the privilege. Valid values: 'present', 'absent'. * 'present' to grant the privilege * 'absent' to revoke the privilege Default value: 'present'. #### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `db` Specifies the database to which you are granting access. ##### `privilege` Specifies comma-separated list of privileges to grant. -Valid values: `ALL`, `CREATE`, `CONNECT`, `TEMPORARY`, `TEMP`. +Valid options: 'ALL', 'CREATE', 'CONNECT', 'TEMPORARY', 'TEMP'. ##### `psql_db` Defines the database to execute the grant against. -**Warning:** This should not ordinarily be changed from the default. +**This should not ordinarily be changed from the default** -Default value: `postgres`. +Default value: 'postgres'. ##### `psql_user` Specifies the OS user for running `psql`. -Default value: the default user for the module, usually `postgres`. +Default value: The default user for the module, usually 'postgres'. ##### `role` Specifies the role or user whom you are granting access to. #### postgresql::server::extension Manages a PostgreSQL extension. ##### `database` Specifies the database on which to activate the extension. ##### `schema` Specifies the schema on which to activate the extension. ##### `ensure` Specifies whether to activate or deactivate the extension. -Valid values: `present` or `absent`. +Valid options: 'present' or 'absent'. -##### `extension` +#### `extension` -Specifies the extension to activate. If left blank, uses the name of -the resource. +Specifies the extension to activate. If left blank, uses the name of the resource. -##### `version` +#### `version` Specifies the version of the extension which the database uses. -When an extension package is updated, this does not automatically change -the effective version in each database. +When an extension package is updated, this does not automatically change the effective version in each database. This needs be updated using the PostgreSQL-specific SQL `ALTER EXTENSION...` -`version` may be set to `latest`, in which case the SQL -`ALTER EXTENSION "extension" UPDATE` is applied to this database (only). +`version` may be set to `latest`, in which case the SQL `ALTER EXTENSION "extension" UPDATE` is applied to this database (only). -`version` may be set to a specific version, in which case the extension is -updated using `ALTER EXTENSION "extension" UPDATE TO 'version'` +`version` may be set to a specific version, in which case the extension is updated using `ALTER EXTENSION "extension" UPDATE TO 'version'` -For example, if extension is set to `postgis` and version is set to `2.3.3`, -this will only apply the SQL `ALTER EXTENSION "postgis" UPDATE TO '2.3.3'` to -the database. +eg. If extension is set to `postgis` and version is set to `2.3.3`, this will apply the SQL `ALTER EXTENSION "postgis" UPDATE TO '2.3.3'` to this database only. -`version` may be omitted, in which case no `ALTER EXTENSION...` SQL is applied, -and the version will be left unchanged. +`version` may be omitted, in which case no `ALTER EXTENSION...` SQL is applied, and the version will be left unchanged. ##### `package_name` Specifies a package to install prior to activating the extension. ##### `package_ensure` Overrides default package deletion behavior. -By default, the package specified with `package_name` is installed when -the extension is activated and removed when the extension is deactivated. -To override this behavior, set the `ensure` value for the package. +By default, the package specified with `package_name` is installed when the extension is activated and removed when the extension is deactivated. To override this behavior, set the `ensure` value for the package. #### postgresql::server::grant -Manages grant-based access privileges for roles. See -[PostgreSQL documentation for `grant`](http://www.postgresql.org/docs/current/static/sql-grant.html) -for more information. +Manages grant-based access privileges for roles. See [PostgreSQL documentation for `grant`](http://www.postgresql.org/docs/current/static/sql-grant.html) for more information. ##### `ensure` Specifies whether to grant or revoke the privilege. Default is to grant the privilege. Valid values: 'present', 'absent'. * 'present' to grant the privilege * 'absent' to revoke the privilege Default value: 'present'. ##### `db` Specifies the database to which you are granting access. ##### `object_type` Specifies the type of object to which you are granting privileges. -Valid values: 'DATABASE', 'SCHEMA', 'SEQUENCE', 'ALL SEQUENCES IN SCHEMA', -'TABLE' or 'ALL TABLES IN SCHEMA'. +Valid options: 'DATABASE', 'SCHEMA', 'SEQUENCE', 'ALL SEQUENCES IN SCHEMA', 'TABLE' or 'ALL TABLES IN SCHEMA'. ##### `object_name` -Specifies name of `object_type` to which to grant access, can be either -a string or a two element array. When it is an array then the first element -must be the `object_type` and the second actual `object_name`. +Specifies name of `object_type` to which to grant access, can be either a string or a two element array. + +String: 'object_name' +Array: ['schema_name', 'object_name'] ##### `port` Port to use when connecting. -Default value: `undef`, which generally defaults to port 5432 depending on your -PostgreSQL packaging. +Default value: `undef`, which generally defaults to port 5432 depending on your PostgreSQL packaging. ##### `privilege` Specifies the privilege to grant. -Valid values: `ALL`, `ALL PRIVILEGES` or `object_type` dependent string. +Valid options: 'ALL', 'ALL PRIVILEGES' or 'object_type' dependent string. ##### `psql_db` Specifies the database to execute the grant against. -**Warning:** This should not ordinarily be changed from the default. +**This should not ordinarily be changed from the default** -Default value: `postgres`. +Default value: 'postgres'. ##### `psql_user` Sets the OS user to run `psql`. -Default value: the default user for the module, usually `postgres`. +Default value: the default user for the module, usually 'postgres'. ##### `role` Specifies the role or user whom you are granting access to. #### postgresql::server::grant_role -Allows you to assign a role to a (group) role. See -[PostgreSQL documentation for `Role Membership`](http://www.postgresql.org/docs/current/static/role-membership.html) -for more information. +Allows you to assign a role to a (group) role. See [PostgreSQL documentation for `Role Membership`](http://www.postgresql.org/docs/current/static/role-membership.html) for more information. ##### `group` Specifies the group role to which you are assigning a role. ##### `role` -Specifies the role you want to assign to a group. If left blank, uses the name -of the resource. +Specifies the role you want to assign to a group. If left blank, uses the name of the resource. ##### `ensure` Specifies whether to grant or revoke the membership. -Valid values: `present` or `absent`. +Valid options: 'present' or 'absent'. -Default value: `present`. +Default value: 'present'. ##### `port` Port to use when connecting. -Default value: `undef`, which generally defaults to port 5432 depending on your -PostgreSQL packaging. +Default value: `undef`, which generally defaults to port 5432 depending on your PostgreSQL packaging. ##### `psql_db` Specifies the database to execute the grant against. -**Warning:** This should not ordinarily be changed from the default. +**This should not ordinarily be changed from the default** -Default value: `postgres`. +Default value: 'postgres'. ##### `psql_user` Sets the OS user to run `psql`. Default value: the default user for the module, usually `postgres`. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. #### postgresql::server::pg_hba_rule -Allows you to create an access rule for `pg_hba.conf`. For more details see -[the usage example](#create-an-access-rule-for-pghba.conf) and -[the PostgreSQL HBA documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html). +Allows you to create an access rule for `pg_hba.conf`. For more details see the [usage example](#create-an-access-rule-for-pghba.conf) and the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html). ##### `address` -Sets a CIDR based address for this rule matching when the type is not `local`. +Sets a CIDR based address for this rule matching when the type is not 'local'. ##### `auth_method` -Provides the method that is used for authentication for the connection that -this rule matches. +Provides the method that is used for authentication for the connection that this rule matches. Described further in the PostgreSQL `pg_hba.conf` documentation. ##### `auth_option` -For certain `auth_method` settings there are extra options that can be passed. +For certain `auth_method` settings there are extra options that can be passed. Consult the PostgreSQL `pg_hba.conf` documentation for further details. ##### `database` Sets a comma-separated list of databases that this rule matches. ##### `description` -Defines a longer description for this rule, if required. This description is -placed in the comments above the rule in `pg_hba.conf`. +Defines a longer description for this rule, if required. This description is placed in the comments above the rule in `pg_hba.conf`. -Default value: `none`. +Default value: 'none'. -Specifies a way to uniquely identify this resource, but functionally does -nothing. +Specifies a way to uniquely identify this resource, but functionally does nothing. ##### `order` Sets an order for placing the rule in `pg_hba.conf`. Default value: 150. #### `postgresql_version` Manages `pg_hba.conf` without managing the entire PostgreSQL instance. Default value: the version set in `postgresql::server`. ##### `target` Provides the target for the rule, and is generally an internal only property. -**Warning:** Use with caution. +**Use with caution.** ##### `type` Sets the type of rule. -Valid values: `local`, `host`, `hostssl` or `hostnossl`. +Valid options: 'local', 'host', 'hostssl' or 'hostnossl'. ##### `user` Sets a comma-separated list of users that this rule matches. + #### postgresql::server::pg_ident_rule -Allows you to create user name maps for `pg_ident.conf`. For more details see -[the usage example](#create-user-name-maps-for-pgidentconf) above and -[the PostgreSQL User Name Maps documentation](http://www.postgresql.org/docs/current/static/auth-username-maps.html). +Allows you to create user name maps for `pg_ident.conf`. For more details see the [usage example](#create-user-name-maps-for-pgidentconf) above and the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/auth-username-maps.html). ##### `database_username` -Specifies the user name of the database user. The `system_username` is mapped -to this user name. +Specifies the user name of the database user. The `system_username` is mapped to this user name. ##### `description` -Sets a longer description for this rule if required. This description is -placed in the comments above the rule in `pg_ident.conf`. +Sets a longer description for this rule if required. This description is placed in the comments above the rule in `pg_ident.conf`. -Default value: `none`. +Default value: 'none'. ##### `map_name` -Sets the name of the user map that is used to refer to this mapping -in `pg_hba.conf`. +Sets the name of the user map that is used to refer to this mapping in `pg_hba.conf`. ##### `order` Defines an order for placing the mapping in `pg_ident.conf`. Default value: 150. ##### `system_username` -Specifies the operating system user name (the user name used to connect to -the database). +Specifies the operating system user name (the user name used to connect to the database). ##### `target` Provides the target for the rule and is generally an internal only property. -**Warning:** Use with caution. +**Use with caution.** #### postgresql::server::reassign_owned_by -Runs the PostgreSQL command `REASSIGN OWNED` on a database, to transfer -the ownership of existing objects between database roles +Runs the PostgreSQL command 'REASSIGN OWNED' on a database, to transfer the ownership of existing objects between database roles ##### `db` -Specifies the database to which the `REASSIGN OWNED` will be applied. +Specifies the database to which the 'REASSIGN OWNED' will be applied ##### `old_role` -Specifies the role or user who is the current owner of the objects in -the specified db. +Specifies the role or user who is the current owner of the objects in the specified db ##### `new_role` -Specifies the role or user who will be the new owner of these objects. +Specifies the role or user who will be the new owner of these objects ##### `psql_user` Specifies the OS user for running `psql`. -Default value: the default user for the module, usually `postgres`. +Default value: The default user for the module, usually 'postgres'. ##### `port` Port to use when connecting. -Default value: `undef`, which generally defaults to port 5432 depending on -your PostgreSQL packaging. +Default value: `undef`, which generally defaults to port 5432 depending on your PostgreSQL packaging. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. #### postgresql::server::recovery -Allows you to create the content for `recovery.conf`. For more details see -[the usage example](#create-recovery-configuration) and -[the PostgreSQL Recovery Configuration documentation](http://www.postgresql.org/docs/current/static/recovery-config.html). +Allows you to create the content for `recovery.conf`. For more details see the [usage example](#create-recovery-configuration) and the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/recovery-config.html). -Every parameter value is a string set in the template except -`recovery_target_inclusive`, `pause_at_recovery_target`, `standby_mode` and -`recovery_min_apply_delay`. +Every parameter value is a string set in the template except `recovery_target_inclusive`, `pause_at_recovery_target`, `standby_mode` and `recovery_min_apply_delay`. -A detailed description of all listed parameters can be found in -[the PostgreSQL documentation](http://www.postgresql.org/docs/current/static/recovery-config.html). +A detailed description of all listed parameters can be found in the [PostgreSQL documentation](http://www.postgresql.org/docs/current/static/recovery-config.html). The parameters are grouped into these three sections: ##### [Archive Recovery Parameters](http://www.postgresql.org/docs/current/static/archive-recovery-settings.html) * `restore_command` * `archive_cleanup_command` * `recovery_end_command` ##### [Recovery Target Settings](http://www.postgresql.org/docs/current/static/recovery-target-settings.html) - * `recovery_target_name` * `recovery_target_time` * `recovery_target_xid` * `recovery_target_inclusive` * `recovery_target` * `recovery_target_timeline` * `pause_at_recovery_target` ##### [Standby Server Settings](http://www.postgresql.org/docs/current/static/standby-settings.html) - -* `standby_mode`: Can be specified with the string (`on`/`off`), or by using a `Boolean` value (`true`/`false`). +* `standby_mode`: Can be specified with the string ('on'/'off'), or by using a Boolean value (`true`/`false`). * `primary_conninfo` * `primary_slot_name` * `trigger_file` * `recovery_min_apply_delay` ##### `target` - Provides the target for the rule, and is generally an internal only property. -**Warning:** Use with caution. +**Use with caution.** #### postgresql::server::role - Creates or drops a role or user in PostgreSQL. ##### `ensure` Specify whether to create or drop the role. Specifying 'present' creates the role. Specifying 'absent' drops the role. Default value: 'present'. ##### `connection_limit` - Specifies how many concurrent connections the role can make. -Default value: `-1`, meaning no limit. +Default value: '-1', meaning no limit. ##### `connect_settings` +Specifies a hash of environment variables used when connecting to a remote server. -Specifies a hash of environment variables used when connecting to a remote -server. - -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `createdb` - Specifies whether to grant the ability to create new databases with this role. Default value: `false`. ##### `createrole` - Specifies whether to grant the ability to create new roles with this role. Default value: `false`. ##### `inherit` - Specifies whether to grant inherit capability for the new role. Default value: `true`. ##### `login` - Specifies whether to grant login capability for the new role. Default value: `true`. ##### `password_hash` - -Sets the hash to use during password creation. If the password is not already -pre-encrypted in a format that PostgreSQL supports, use -the `postgresql_password` function to provide an MD5 hash here, for example: +Sets the hash to use during password creation. If the password is not already pre-encrypted in a format that PostgreSQL supports, use the `postgresql_password` function to provide an MD5 hash here, for example: ##### `update_password` - -If set to true, updates the password on changes. Set this to false to not -modify the role's password after creation. +If set to true, updates the password on changes. Set this to false to not modify the role's password after creation. ```puppet postgresql::server::role { 'myusername': password_hash => postgresql_password('myusername', 'mypassword'), } ``` ##### `replication` Provides provides replication capabilities for this role if set to `true`. Default value: `false`. ##### `superuser` Specifies whether to grant super user capability for the new role. Default value: `false`. ##### `username` Defines the username of the role to create. Default value: the namevar. #### postgresql::server::schema Creates a schema. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `db` Required. Sets the name of the database in which to create this schema. ##### `owner` Sets the default owner of the schema. ##### `schema` Sets the name of the schema. Default value: the namevar. #### postgresql::server::table_grant -Manages grant-based access privileges for users. Consult -[the PostgreSQL documentation for `GRANT`](http://www.postgresql.org/docs/current/static/sql-grant.html) -for more information. +Manages grant-based access privileges for users. Consult the PostgreSQL documentation for `grant` for more information. ##### `ensure` Specifies whether to grant or revoke the privilege. Default is to grant the privilege. Valid values: 'present', 'absent'. * 'present' to grant the privilege * 'absent' to revoke the privilege Default value: 'present'. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `db` Specifies which database the table is in. ##### `privilege` -Specifies comma-separated list of privileges to grant. - -Valid values: `ALL`, `SELECT`, `INSERT`, `UPDATE`, `DELETE`, `TRUNCATE`, -`REFERENCES`, `TRIGGER`. +Specifies comma-separated list of privileges to grant. Valid options: 'ALL', 'SELECT', 'INSERT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER'. ##### `psql_db` Specifies the database to execute the grant against. -**Warning:** This should not ordinarily be changed from the default. +This should not ordinarily be changed from the default. -Default value: `postgres`. +Default value: 'postgres'. ##### `psql_user` Specifies the OS user for running `psql`. -Default value: the default user for the module, usually `postgres`. +Default value: The default user for the module, usually 'postgres'. ##### `role` Specifies the role or user to whom you are granting access. ##### `table` Specifies the table to which you are granting access. #### postgresql::server::tablespace -Creates a tablespace. If necessary, also creates the location and assigns -the same permissions as the PostgreSQL server. +Creates a tablespace. If necessary, also creates the location and assigns the same permissions as the PostgreSQL server. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. +Specifies a hash of environment variables used when connecting to a remote server. -Default value: local PostgreSQL instance. +Default value: Connects to the local Postgres instance. ##### `location` Specifies the path to locate this tablespace. ##### `owner` Specifies the default owner of the tablespace. ##### `spcname` Specifies the name of the tablespace. Default value: the namevar. ### Types #### postgresql_psql -Enables Puppet to run `psql` statements. +Enables Puppet to run psql statements. ##### `command` Required. -Specifies the SQL command to execute via `psql`. +Specifies the SQL command to execute via psql. ##### `cwd` -Specifies the working directory under which the `psql` command should be -executed. +Specifies the working directory under which the psql command should be executed. -Default value: `/tmp`. +Default value: '/tmp'. ##### `db` Specifies the name of the database to execute the SQL command against. ##### `environment` -Specifies any additional environment variables you want to set for a SQL -command. Multiple environment variables should be specified as an array. +Specifies any additional environment variables you want to set for a SQL command. Multiple environment variables should be specified as an array. ##### `name` -Sets an arbitrary tag for your own reference; the name of the message. -This is the namevar. +Sets an arbitrary tag for your own reference; the name of the message. This is the namevar. ##### `onlyif` -Sets an optional SQL command to execute prior to the main command. This is -generally intended to be used for idempotency, to check for the existence of -an object in the database to determine whether or not the main SQL command -needs to be executed at all. +Sets an optional SQL command to execute prior to the main command. This is generally intended to be used for idempotency, to check for the existence of an object in the database to determine whether or not the main SQL command needs to be executed at all. ##### `port` Specifies the port of the database server to execute the SQL command against. ##### `psql_group` -Specifies the system user group account under which the `psql` command should -be executed. +Specifies the system user group account under which the psql command should be executed. -Default value: `postgres`. +Default value: 'postgres'. ##### `psql_path` -Specifies the path to `psql` executable. +Specifies the path to psql executable. -Default value: `psql`. +Default value: 'psql'. ##### `psql_user` -Specifies the system user account under which the `psql` command should be -executed. +Specifies the system user account under which the psql command should be executed. -Default value: `postgres`. +Default value: 'postgres'. ##### `refreshonly` -Specifies whether to execute the SQL only if there is a notify or subscribe -event. +Specifies whether to execute the SQL only if there is a notify or subscribe event. Valid values: `true`, `false`. Default value: `false`. ##### `search_path` Defines the schema search path to use when executing the SQL command. ##### `unless` The inverse of `onlyif`. #### postgresql_conf Allows Puppet to manage `postgresql.conf` parameters. ##### `name` Specifies the PostgreSQL parameter name to manage. This is the namevar. ##### `target` Specifies the path to `postgresql.conf`. -Default value: `/etc/postgresql.conf`. +Default value: '/etc/postgresql.conf'. ##### `value` Specifies the value to set for this parameter. #### postgresql_replication_slot -Allows you to create and destroy replication slots to register warm standby -replication on a PostgreSQL master server. +Allows you to create and destroy replication slots to register warm standby replication on a PostgreSQL master server. ##### `name` -Specifies the name of the slot to create. Must be a valid replication slot -name. +Specifies the name of the slot to create. Must be a valid replication slot name. This is the namevar. ##### `ensure` Required. Specifies the action to create or destroy named slot. -Valid values: `present`, `absent`. +Valid values: 'present', 'absent'. -Default value: `present`. +Default value: 'present'. #### postgresql_conn_validator -Validate the connection to a local or remote PostgreSQL database using this -type. +Validate the connection to a local or remote PostgreSQL database using this type. ##### `connect_settings` -Specifies a hash of environment variables used when connecting to a remote -server. This is an alternative to providing individual parameters -(`host`, etc). If provided, the individual parameters take precedence. +Specifies a hash of environment variables used when connecting to a remote server. This is an alternative to providing individual parameters (`host`, etc). If provided, the individual parameters take precedence. -Default value: `{}` +Default value: {} ##### `db_name` Specifies the name of the database you wish to test. -Default value: `''` +Default value: '' ##### `db_password` -Specifies the password to connect with. Can be left blank if `.pgpass` is -being used, otherwise not recommended. +Specifies the password to connect with. Can be left blank if `.pgpass` is being used, otherwise not recommended. -Default value: `''` +Default value: '' ##### `db_username` Specifies the username to connect with. -Default value: `''` +Default value: '' When using a Unix socket and ident auth, this is the user you are running as. ##### `command` This is the command run against the target database to verify connectivity. -Default value: `SELECT 1` +Default value: 'SELECT 1' ##### `host` Sets the hostname of the database you wish to test. -Default value: `''`, which generally uses the designated local Unix socket. +Default value: '', which generally uses the designated local Unix socket. -**Warning:** If the host is remote you must provide a username. +**If the host is remote you must provide a username.** ##### `port` Defines the port to use when connecting. -Default value: `''` +Default value: '' ##### `run_as` -Specifies the user to run the `psql` command as. This is important when trying -to connect to a database locally using Unix sockets and `ident` authentication. -Not needed for remote testing. +Specifies the user to run the `psql` command as. This is important when trying to connect to a database locally using Unix sockets and `ident` authentication. Not needed for remote testing. ##### `sleep` Sets the number of seconds to sleep for before trying again after a failure. ##### `tries` -Sets the number of attempts after failure before giving up and failing -the resource. +Sets the number of attempts after failure before giving up and failing the resource. ### Functions #### postgresql_password -Generates a PostgreSQL encrypted password, use `postgresql_password`. Call it -from the command line and then copy and paste the encrypted password into your -manifest: +Generates a PostgreSQL encrypted password, use `postgresql_password`. Call it from the command line and then copy and paste the encrypted password into your manifest: ```shell puppet apply --execute 'notify { 'test': message => postgresql_password('username', 'password') }' ``` -Alternatively, you can call this from your production manifests, but -the manifests will then contain a clear text version of your passwords. +Alternatively, you can call this from your production manifests, but the manifests will then contain a clear text version of your passwords. #### postgresql_acls_to_resources_hash(acl_array, id, order_offset) -This internal function converts a list of `pg_hba.conf` based ACLs (passed in -as an array of strings) to a format compatible with -the `postgresql::pg_hba_rule` resource. +This internal function converts a list of `pg_hba.conf` based ACLs (passed in as an array of strings) to a format compatible with the `postgresql::pg_hba_rule` resource. -**Warning:** This function should only be used internally by the module. +**This function should only be used internally by the module**. ### Tasks -The postgresql module has an example task that allows a user to execute -arbitrary SQL against a database. Please refer to to -[the PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or -[the Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how -to execute a task. +The Postgresql module has an example task that allows a user to execute arbitary SQL against a database. Please refer to to the [PE documentation](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html) or [Bolt documentation](https://puppet.com/docs/bolt/latest/bolt.html) on how to execute a task. ## Limitations Works with versions of PostgreSQL from 8.1 through 9.5. Currently, the postgresql module is tested on the following operating systems: * Debian 6.x, 7.x, 8.x. * CentOS 5.x, 6.x, and 7.x. * Ubuntu 10.04 and 12.04, 14.04. Other systems might be compatible, but are not being actively tested. ### Apt module support -While this module supports both 1.x and 2.x versions of the puppetlabs-apt -module, it does not support puppetlabs-apt 2.0.0 or 2.0.1. +While this module supports both 1.x and 2.x versions of the 'puppetlabs-apt' module, it does not support 'puppetlabs-apt' 2.0.0 or 2.0.1. ### PostGIS support -PostGIS is currently considered an unsupported feature, as it doesn't work on -all platforms correctly. +PostGIS is currently considered an unsupported feature, as it doesn't work on all platforms correctly. ### All versions of RHEL/CentOS -If you have SELinux enabled you must add any custom ports you use to -the `postgresql_port_t` context. You can do this as follows: +If you have SELinux enabled you must add any custom ports you use to the `postgresql_port_t` context. You can do this as follows: ```shell semanage port -a -t postgresql_port_t -p tcp $customport ``` ## Development -Puppet Labs modules on the Puppet Forge are open projects, and community -contributions are essential for keeping them great. We can't access the huge -number of platforms and myriad hardware, software, and deployment -configurations that Puppet is intended to serve. We want to keep it as easy -as possible to contribute changes so that our modules work in your environment. -There are a few guidelines that we need contributors to follow so that we can -have a chance of keeping on top of things. For more information, see our -[module contribution guide](https://docs.puppetlabs.com/forge/contributing.html). +Puppet Labs modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide](https://docs.puppetlabs.com/forge/contributing.html). ### Tests -There are two types of tests distributed with this module. Unit tests with -`rspec-puppet` and system tests using `rspec-system`. +There are two types of tests distributed with this module. Unit tests with `rspec-puppet` and system tests using `rspec-system`. For unit testing, make sure you have: * rake * bundler Install the necessary gems: ```shell bundle install --path=vendor ``` And then run the unit tests: ```shell bundle exec rake spec ``` -The unit tests are run in Travis-CI as well. If you want to see the results of -your own tests, register the service hook through Travis-CI via the accounts -section for your GitHub clone of this project. +The unit tests are run in Travis-CI as well. If you want to see the results of your own tests, register the service hook through Travis-CI via the accounts section for your GitHub clone of this project. To run the system tests, make sure you also have: * Vagrant > 1.2.x * VirtualBox > 4.2.10 Then run the tests using: ```shell bundle exec rspec spec/acceptance ``` -To run the tests on different operating systems, see the sets available -in `.nodeset.yml` and run the specific set with the following syntax: +To run the tests on different operating systems, see the sets available in `.nodeset.yml` and run the specific set with the following syntax: ```shell RSPEC_SET=debian-607-x64 bundle exec rspec spec/acceptance ``` ### Contributors -View the full list of contributors on -[GitHub](https://github.com/puppetlabs/puppetlabs-postgresql/graphs/contributors). +View the full list of contributors on [Github](https://github.com/puppetlabs/puppetlabs-postgresql/graphs/contributors). diff --git a/readmes/README_ja_JP.md b/readmes/README_ja_JP.md index 6517e36..7d35811 100644 --- a/readmes/README_ja_JP.md +++ b/readmes/README_ja_JP.md @@ -1,1927 +1,1927 @@ # postgresql #### 目次 1. [モジュールの概要 - モジュールの機能](#module-description) 2. [セットアップ - postgresqlモジュール導入の基本](#setup) * [postgresqlの影響](#what-postgresql-affects) * [postgresqlの導入](#getting-started-with-postgresql) 3. [使用方法 - 設定オプションと追加機能](#usage) * [サーバーの設定](#configure-a-server) * [データベースの作成](#create-a-database) * [ユーザ、ロール、パーミッションの管理](#manage-users-roles-and-permissions) * [DBオブジェクトの所有権の管理](#manage-ownership-of-db-objects) * [デフォルトのオーバーライド](#override-defaults) * [pg_hba.confのアクセスルールの作成](#create-an-access-rule-for-pg_hbaconf) * [pg_ident.confのユーザ名マップの作成](#create-user-name-maps-for-pg_identconf) * [接続の検証](#validate-connectivity) 4. [参考 - モジュールの機能と動作について](#reference) * [クラス](#classes) * [定義できるタイプ](#defined-types) * [タイプ](#types) * [関数](#functions) * [タスク](#tasks) 5. [制約事項 - OSの互換性など](#limitations) 6. [開発 - モジュール貢献についてのガイド](#development) * [コントリビュータ - モジュール貢献者の一覧](#contributors) 7. [テスト](#tests) 8. [コントリビュータ - モジュール貢献者の一覧](#contributors) ## モジュールの概要 postgresqlモジュールを使用すると、PuppetでPostgreSQLを管理できます。 PostgreSQLは、高性能な無償のオープンソースリレーショナルデータベースサーバーです。postgresqlモジュールを使用すると、PostgreSQLのパッケージ、サービス、データベース、ユーザ、一般的なセキュリティ設定を管理できるようになります。 ## セットアップ ### postgresqlの影響 * PostgreSQLのパッケージ、サービス、設定ファイル * リッスンするポート * IPおよびマスク(オプション) ### postgresqlの導入 基本的なデフォルトのPostgreSQLサーバーを設定するには、`postgresql::server`クラスを宣言します。 ```puppet class { 'postgresql::server': } ``` ## 使用方法 ### サーバーの設定 デフォルト設定を使用する場合は、上記のように`postgresql::server`クラスを宣言します。PostgreSQLサーバーの設定をカスタマイズするには、次のように、変更する[パラメータ](#postgresqlserver)を指定します。 ```puppet class { 'postgresql::server': ip_mask_deny_postgres_user => '0.0.0.0/32', ip_mask_allow_all_users => '0.0.0.0/0', ipv4acls => ['hostssl all johndoe 192.168.0.0/24 cert'], postgres_password => 'TPSrep0rt!', } ``` 設定後、コマンドラインで設定をテストします。 ```shell psql -h localhost -U postgres psql -h my.postgres.server -U ``` 上記のコマンドでエラーメッセージが返ってくる場合は、パーミッションの設定によって現在の接続元からのアクセスが制限されています。その場所からの接続を許可するかどうかに応じて、パーミッション設定の変更が必要な場合があります。 サーバー設定パラメータの詳細については、[PostgreSQLランタイム設定マニュアル](http://www.postgresql.org/docs/current/static/runtime-config.html)を参照してください。 ### データベースの作成 さまざまなPostgreSQLデータベースを定義タイプ`postgresql::server::db`を使用してセットアップできます。例えば、PuppetDBのデータベースをセットアップするには、次のように記述します。 ```puppet class { 'postgresql::server': } postgresql::server::db { 'mydatabasename': user => 'mydatabaseuser', password => postgresql_password('mydatabaseuser', 'mypassword'), } ``` ### ユーザ、ロール、パーミッションの管理 ユーザ、ロール、パーミッションを管理するには、次のようにします。 ```puppet class { 'postgresql::server': } postgresql::server::role { 'marmot': password_hash => postgresql_password('marmot', 'mypasswd'), } postgresql::server::database_grant { 'test1': privilege => 'ALL', db => 'test1', role => 'marmot', } postgresql::server::table_grant { 'my_table of test2': privilege => 'ALL', table => 'my_table', db => 'test2', role => 'marmot', } ``` この例では、test1データベース上とtest2データベースの`my_table`テーブル上の**すべての**権限を、指定したユーザまたはグループに付与します。値がPuppetDB設定ファイルに追加されると、このデータベースは使用可能になります。 ### DBオブジェクトの所有権の管理 REASSIGN OWNEDを使用して、データベース内にあるすべてのオブジェクトの所有権を変更するには、次のようにします。 ```puppet postgresql::server::reassign_owned_by { 'new owner is meerkat': db => 'test_db', old_owner => 'marmot', new_owner => 'meerkat', } ``` この例では、PostgreSQLの'REASSIGN OWNED'ステートメントを実行して所有権を更新し、現在、ロール'marmot'が所有しているすべてのテーブル、シーケンス、関数、ビューが、ロール'meerkat'に所有されるようにします。 これは、指定された'test_db'内のオブジェクトに対してのみ適用されます。 バージョン9.3以上のPostgresqlでは、データベースの所有権も更新されます。 ### デフォルトのオーバーライド `postgresql::globals`クラスを使用すると、このモジュールの主な設定をグローバルに構成できます。この設定は、他のクラスや定義済みリソースから使用できます。単独では機能しません。 例えば、すべてのクラスのデフォルトの`locale`と`encoding`をオーバーライドするには、次のように記述します。 ```puppet class { 'postgresql::globals': encoding => 'UTF-8', locale => 'en_US.UTF-8', } class { 'postgresql::server': } ``` 特定のバージョンのPostgreSQLパッケージを使用するには、次のように記述します。 ```puppet class { 'postgresql::globals': manage_package_repo => true, version => '9.2', } class { 'postgresql::server': } ``` ### リモートのユーザ、ロール、パーミッションの管理 リモートのSQLオブジェクトは、ローカルのSQLオブジェクトと同じPuppetリソースと、[`connect_settings`](#connect_settings)ハッシュを使用して管理します。これは、PuppetがリモートのPostgresインスタンスに接続する方法と、SQLコマンドの生成に使用されるバージョンを制御します。 `connect_settings`ハッシュには、'PGHOST'、'PGPORT'、'PGPASSWORD'、'PGSSLKEY'など、Postgresクライアント接続を制御する環境変数を含めることができます。変数の全リストについては、[PostgreSQL環境変数](http://www.postgresql.org/docs/9.4/static/libpq-envars.html)マニュアルを参照してください。 さらに、特殊値の'DBVERSION'により、ターゲットデータベースのバージョンを指定できます。`connect_settings`ハッシュが省略されているか空の場合、PuppetはローカルのPostgreSQLインスタンスに接続します。 Puppetリソースごとに`connect_settings`ハッシュを設定するか、`postgresql::globals`にデフォルトの`connect_settings`ハッシュを設定できます。リソースごとに`connect_settings`を設定すると、SQLオブジェクトが複数のユーザによって複数のデータベース上に作成できるようになります。 ```puppet $connection_settings_super2 = { 'PGUSER' => 'super2', 'PGPASSWORD' => 'foobar2', 'PGHOST' => '127.0.0.1', 'PGPORT' => '5432', 'PGDATABASE' => 'postgres', } include postgresql::server # Connect with no special settings, i.e domain sockets, user postgres postgresql::server::role { 'super2': password_hash => 'foobar2', superuser => true, connect_settings => {}, } # Now using this new user connect via TCP postgresql::server::database { 'db1': connect_settings => $connection_settings_super2, require => Postgresql::Server::Role['super2'], } ``` ### pg_hba.confのアクセスルールの作成 `pg_hba.conf`のアクセスルールを作成するには、次のように記述します。 ```puppet postgresql::server::pg_hba_rule { 'allow application network to access app database': description => 'Open up PostgreSQL for access from 200.1.2.0/24', type => 'host', database => 'app', user => 'app', address => '200.1.2.0/24', auth_method => 'md5', } ``` これにより、以下のようなルールセットが`pg_hba.conf`内に作成されます。 ``` # Rule Name: allow application network to access app database # Description: Open up PostgreSQL for access from 200.1.2.0/24 # Order: 150 host app app 200.1.2.0/24 md5 ``` デフォルトでは、`pg_hba_rule`に`postgresql::server`を含める必要がありますが、ルールを宣言する際にtargetおよびpostgresql_versionを設定することで、その動作をオーバーライドできます。例えば次のようになります。 ```puppet postgresql::server::pg_hba_rule { 'allow application network to access app database': description => 'Open up postgresql for access from 200.1.2.0/24', type => 'host', database => 'app', user => 'app', address => '200.1.2.0/24', auth_method => 'md5', target => '/path/to/pg_hba.conf', postgresql_version => '9.4', } ``` ### pg_ident.confのユーザ名マップの作成 pg_ident.confのユーザ名マップを作成するには、次のように記述します。 ```puppet postgresql::server::pg_ident_rule { 'Map the SSL certificate of the backup server as a replication user': map_name => 'sslrepli', system_username => 'repli1.example.com', database_username => 'replication', } ``` これにより、次のようなユーザ名マップが`pg_ident.conf`に作成されます。 ``` #Rule Name: Map the SSL certificate of the backup server as a replication user #Description: none #Order: 150 sslrepli repli1.example.com replication ``` ### リカバリ設定の作成 リカバリ設定ファイル(`recovery.conf`)を作成するには、次のように記述します。 ```puppet postgresql::server::recovery { 'Create a recovery.conf file with the following defined parameters': restore_command => 'cp /mnt/server/archivedir/%f %p', archive_cleanup_command => undef, recovery_end_command => undef, recovery_target_name => 'daily backup 2015-01-26', recovery_target_time => '2015-02-08 22:39:00 EST', recovery_target_xid => undef, recovery_target_inclusive => true, recovery_target => 'immediate', recovery_target_timeline => 'latest', pause_at_recovery_target => true, standby_mode => 'on', primary_conninfo => 'host=localhost port=5432', primary_slot_name => undef, trigger_file => undef, recovery_min_apply_delay => 0, } ``` これにより、次の`recovery.conf`設定ファイルが作成されます。 ``` restore_command = 'cp /mnt/server/archivedir/%f %p' recovery_target_name = 'daily backup 2015-01-26' recovery_target_time = '2015-02-08 22:39:00 EST' recovery_target_inclusive = true recovery_target = 'immediate' recovery_target_timeline = 'latest' pause_at_recovery_target = true standby_mode = 'on' primary_conninfo = 'host=localhost port=5432' recovery_min_apply_delay = 0 ``` テンプレートでは、指定されたパラメータのみが認識されます。`recovery.conf`は、少なくとも1つのパラメータが設定済みで、**かつ**、[manage_recovery_conf](#manage_recovery_conf)がtrueの場合のみ作成されます。 ### 接続の検証 従属タスクを開始する前に、リモートのPostgreSQLデータベースへのクライアント接続を検証するには、`postgresql_conn_validator`リソースを使用します。このリソースは、PostgreSQLクライアントソフトウェアがインストールされている任意のノード上で使用できます。アプリケーションサーバーの起動や、データベース移行の実行など、他のタスクと結合されることがよくあります。 使用例: ```puppet postgresql_conn_validator { 'validate my postgres connection': host => 'my.postgres.host', db_username => 'mydbuser', db_password => 'mydbpassword', db_name => 'mydbname', }-> exec { 'rake db:migrate': cwd => '/opt/myrubyapp', } ``` ## リファレンス postgresqlモジュールには、サーバー設定用に多数のオプションがあります。以下の設定をすべて使うことはないかもしれませんが、これらを使用することで、セキュリティ設定をかなり制御することができます。 **クラス:** * [postgresql::client](#postgresqlclient) * [postgresql::globals](#postgresqlglobals) * [postgresql::lib::devel](#postgresqllibdevel) * [postgresql::lib::java](#postgresqllibjava) * [postgresql::lib::perl](#postgresqllibperl) * [postgresql::lib::python](#postgresqllibpython) * [postgresql::server](#postgresqlserver) * [postgresql::server::plperl](#postgresqlserverplperl) * [postgresql::server::contrib](#postgresqlservercontrib) * [postgresql::server::postgis](#postgresqlserverpostgis) **定義できるタイプ:** * [postgresql::server::config_entry](#postgresqlserverconfig_entry) * [postgresql::server::database](#postgresqlserverdatabase) * [postgresql::server::database_grant](#postgresqlserverdatabase_grant) * [postgresql::server::db](#postgresqlserverdb) * [postgresql::server::extension](#postgresqlserverextension) * [postgresql::server::grant](#postgresqlservergrant) * [postgresql::server::grant_role](#postgresqlservergrant_role) * [postgresql::server::pg_hba_rule](#postgresqlserverpg_hba_rule) * [postgresql::server::pg_ident_rule](#postgresqlserverpg_ident_rule) * [postgresql::server::reassign_owned_by](#postgresqlserverreassign_owned_by) * [postgresql::server::recovery](#postgresqlserverrecovery) * [postgresql::server::role](#postgresqlserverrole) * [postgresql::server::schema](#postgresqlserverschema) * [postgresql::server::table_grant](#postgresqlservertable_grant) * [postgresql::server::tablespace](#postgresqlservertablespace) **タイプ:** * [postgresql_psql](#custom-resource-postgresql_psql) * [postgresql_replication_slot](#custom-resource-postgresql_replication_slot) * [postgresql_conf](#custom-resource-postgresql_conf) * [postgresql_conn_validator](#custom-resource-postgresql_conn_validator) **関数:** * [postgresql_password](#function-postgresql_password) * [postgresql_acls_to_resources_hash](#function-postgresql_acls_to_resources_hashacl_array-id-order_offset) **タスク:** * [`sql`](#tasks) ### クラス #### postgresql::client PostgreSQLクライアントソフトウェアをインストールします。カスタムのバージョンをインストールするには、次のパラメータを設定します。 >**注意:** カスタムのバージョンを指定する場合、必要なyumまたはaptリポジトリを忘れずに追加してください。 ##### `package_ensure` PostgreSQLクライアントパッケージリソースが存在する必要があるかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 ##### `package_name` PostgreSQLクライアントパッケージの名前を設定します。 デフォルト値: 'file'。 #### postgresql::lib::docs Postgres-Docs向けのPostgreSQLバインディングをインストールします。カスタムのバージョンをインストールするには、次のパラメータを設定します。 **注意:** カスタムのバージョンを指定する場合、必要なyumまたはaptリポジトリを忘れずに追加してください。 ##### `package_name` PostgreSQL docsパッケージの名前を指定します。 ##### `package_ensure` PostgreSQL docsパッケージリソースが存在する必要があるかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 #### postgresql::globals **注意:** ほとんどのサーバー固有のデフォルト値は、`postgresql::server`クラスでオーバーライドする必要があります。このクラスは、標準以外のOSを使用している場合か、ここでしか変更できない要素(`version`や`manage_package_repo`)を変更する場合のみ使用します。 ##### `bindir` ターゲットプラットフォームのデフォルトのPostgreSQLバイナリディレクトリをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `client_package_name` デフォルトのPostgreSQLクライアントパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `confdir`  ターゲットプラットフォームのデフォルトのPostgreSQL設定ディレクトリをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `contrib_package_name` デフォルトのPostgreSQL contribパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `createdb_path` **非推奨** `createdb`コマンドへのパス。 デフォルト値: '${bindir}/createdb'。 ##### `datadir` ターゲットプラットフォームのデフォルトのPostgreSQLデータディレクトリをオーバーライドします。 デフォルト値: OSによって異なります。 **注意:** インストール後にdatadirを変更すると、変更が実行される前にサーバーが完全に停止します。Red Hatシステムでは、データディレクトリはSELinuxに適切にラベル付けする必要があります。Ubuntuでは、明示的に`needs_initdb = true`に設定して、Puppetが新しいdatadir内のデータベースを初期化できるようにする必要があります(他のシステムでは、`needs_initdb`はデフォルトでtrueになっています)。 **警告:** datadirがデフォルトから変更された場合、Puppetは元のデータディレクトリのパージを管理しません。そのため、データディレクトリが元のディレクトリに戻ったときにエラーが発生します。 ##### `data_checksums` オプションです。 データタイプ: 真偽値(boolean) データページに対してチェックサムを使用すると、その他の方法では発見の難しいI/Oシステムによる破損を検出するのに役立ちます。 有効な値: `true`、`false`。 デフォルト値: initdbのデフォルト値(`false`)。 **警告:** このオプションは、initdbによって初期化中に使用され、後から変更することはできません。設定された時点で、すべてのデータベース内のすべてのオブジェクトに対してチェックサムが計算されます。 ##### `default_database` 接続するデフォルトのデータベースの名前を指定します。 デフォルト値: (ほとんどのシステムにおいて) 'postgres'。 ##### `devel_package_name` デフォルトのPostgreSQL develパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `docs_package_name` オプションです。 デフォルトのPostgreSQL docsパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `encoding` このモジュールで作成されるすべてのデータベースのデフォルトエンコーディングを設定します。オペレーティングシステムによっては、`template1` の初期化にも使用されます。その場合、モジュール外部のデフォルトにもなります。 デフォルト値: オペレーティングシステムのデフォルトエンコーディングによって決まります。 ##### `group` ファイルシステムの関連ファイルに使用されるデフォルトのpostgresユーザグループをオーバーライドします。 デフォルト値: 'postgres'。 ##### `initdb_path` `initdb`コマンドへのパス。 ##### `java_package_name` デフォルトのPostgreSQL javaパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `locale` このモジュールで作成されるすべてのデータベースのデフォルトのデータベースロケールを設定します。オペレーティングシステムによっては、`template1` の初期化にも使用されます。その場合、モジュール外部のデフォルトにもなります。 デフォルト値: `undef`、実質的には'C'。 **Debianでは、PostgreSQLのフル機能が使用できるように'locales-all'パッケージがインストールされていることを確認する必要があります。** ##### `timezone` postgresqlサーバーのデフォルトタイムゾーンを設定します。postgresqlのビルトインのデフォルト値は、システムのタイムゾーン情報を取得しています。 ##### `logdir` デフォルトのPostgreSQL logディレクトリをオーバーライドします。 デフォルト値: initdbのデフォルトパス。 ##### `manage_package_repo` `true`に設定されている場合、お使いのホスト上に公式なPostgreSQLリポジトリをセットアップします。 デフォルト値: `false`。 ##### `module_workdir` psqlコマンドを実行する作業ディレクトリを指定します。'/tmp'がnoexecオプションでマウントされたボリューム上にあるときに、指定が必要になる場合があります。 デフォルト値: '/tmp'。 ##### `needs_initdb` サーバーパッケージをインストール後、PostgreSQLサービスを開始する前に、initdb動作を明示的に呼び出します。 デフォルト値: OSによって異なります。 ##### `perl_package_name` デフォルトのPostgreSQL Perlパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `pg_hba_conf_defaults` `false`に設定すると、`pg_hba.conf`についてモジュールに設定されたデフォルト値を無効にします。デフォルト値をオーバーライドするときに役立ちます。ただし、基本的な`psql`動作など、一定の動作を行うためには一定のアクセスが要求されるので、ここでの変更内容がその他のモジュールと矛盾しないように注意してください。 デフォルト値: `postgresql::globals::manage_pg_hba_conf`に設定されたグローバル値。デフォルトは`true`。 ##### `pg_hba_conf_path` `pg_hba.conf`ファイルへのパスを指定します。 デフォルト値: '${confdir}/pg_hba.conf'。 ##### `pg_ident_conf_path` `pg_ident.conf`ファイルへのパスを指定します。 デフォルト値: '${confdir}/pg_ident.conf'。 ##### `plperl_package_name` デフォルトのPostgreSQL PL/Perlパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `plpython_package_name` デフォルトのPostgreSQL PL/Pythonパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `postgis_version` PostGISをインストールする場合に、インストールするPostGISのバージョンを定義します。 デフォルト値: インストールするPostgreSQLで利用可能な最下位のバージョン。 ##### `postgresql_conf_path` `postgresql.conf`ファイルへのパスを設定します。 デフォルト値: '${confdir}/postgresql.conf'。 ##### `psql_path` `psql`コマンドへのパスを設定します。 ##### `python_package_name` デフォルトのPostgreSQL Pythonパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `recovery_conf_path` `recovery.conf`ファイルへのパス。 ##### `repo_proxy` 公式のPostgreSQL yumリポジトリのみのプロキシオプションを設定します。これは、サーバーが企業のファイアウォール内にあり、外部への接続にプロキシを使用する必要がある場合に役立ちます。 Debianは現在サポートされていません。 ##### `repo_baseurl` PostgreSQLリポジトリのbaseurlを設定します。リポジトリのミラーを所有している場合に便利です。 デフォルト値: 公式なPostgreSQLリポジトリ。 ##### `server_package_name` デフォルトのPostgreSQLサーバーパッケージ名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `service_name` デフォルトのPostgreSQLサービス名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `service_provider` デフォルトのPostgreSQLサービスプロバイダをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `service_status` PostgreSQLサービスのデフォルトのステータスチェックコマンドをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `user` ファイルシステム内のPostgreSQL関連ファイルのデフォルトのPostgreSQLスーパーユーザおよび所有者をオーバーライドします。 デフォルト値: 'postgres'。 ##### `version` インストールおよび管理するPostgreSQLのバージョン。 デフォルト値: OSシステムのデフォルト値。 ##### `xlogdir` デフォルトのPostgreSQL xlogディレクトリをオーバーライドします。 デフォルト値: initdbのデフォルトパス。 #### postgresql::lib::devel PostgreSQLの開発ライブラリとシンボリックリンク`pg_config`を含むパッケージを`/usr/bin`にインストールします(`/usr/bin`または`/usr/local/bin`に存在しない場合)。 ##### `link_pg_config` PostgreSQLページが使用するbinディレクトリが`/usr/bin`でも`/usr/local/bin`でもない場合、パッケージのbinディレクトリから`usr/bin`に`pg_config`をシンボリックリンクします(Debianシステムには適用されません)。この動作を無効にするには、`false`に設定します。 有効な値: `true`、`false`。 デフォルト値: `true`。 ##### `package_ensure` パッケージのインストール中に'ensure'パラメータをオーバーライドします。 デフォルト値: 'present'。 ##### `package_name` インストール先のディストリビューションのデフォルトパッケージ名をオーバーライドします。 デフォルト値: ディストリビューションに応じて、'postgresql-devel'または'postgresql-devel'。 #### postgresql::lib::java Java (JDBC)向けのPostgreSQLバインディングをインストールします。カスタムのバージョンをインストールするには、次のパラメータを設定します。 **注意:** カスタムのバージョンを指定する場合、必要なyumまたはaptリポジトリを忘れずに追加してください。 ##### `package_ensure` パッケージが存在するかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 ##### `package_name` PostgreSQL javaパッケージの名前を指定します。 #### postgresql::lib::perl PostgreSQL Perlライブラリをインストールします。 ##### `package_ensure` パッケージが存在するかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 ##### `package_name` インストールするPostgreSQL perlパッケージの名前を指定します。 #### postgresql::server::plpython PostgreSQLのPL/Python手続き型言語をインストールします。 ##### `package_name` postgresql PL/Pythonパッケージの名前を指定します。 ##### `package_ensure` パッケージが存在するかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 #### postgresql::lib::python PostgreSQL Pythonライブラリをインストールします。 ##### `package_ensure` パッケージが存在するかどうかを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 ##### `package_name` PostgreSQL Pythonパッケージの名前。 #### postgresql::server ##### `createdb_path` **非推奨** `createdb`コマンドへのパスを指定します。 デフォルト値: '${bindir}/createdb'。 ##### `data_checksums` オプションです。 データタイプ: 真偽値(boolean) データページに対してチェックサムを使用すると、その他の方法では発見の難しいI/Oシステムによる破損を検出するのに役立ちます。 有効な値: `true`、`false`。 デフォルト値: initdbのデフォルト値(`false`)。 **警告:** このオプションは、initdbによって初期化中に使用され、後から変更することはできません。設定された時点で、すべてのデータベース内のすべてのオブジェクトに対してチェックサムが計算されます。 ##### `default_database` 接続するデフォルトのデータベースの名前を指定します。ほとんどのシステムで、'postgres'になります。 ##### `default_connect_settings` リモートサーバーに接続する際に使用される環境変数のハッシュを指定します。他の定義タイプのデフォルトとして使用されます(`postgresql::server::role`など)。 ##### `encoding` このモジュールで作成されるすべてのデータベースのデフォルトエンコーディングを設定します。オペレーティングシステムによっては、`template1` の初期化にも使用されます。その場合、モジュール外部のデフォルトにもなります。 デフォルト値: `undef`。 ##### `group` ファイルシステムの関連ファイルに使用されるデフォルトのpostgresユーザグループをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `initdb_path` `initdb`コマンドへのパスを指定します。 デフォルト値: '${bindir}/initdb'。 ##### `ipv4acls` 接続方法、ユーザ、データベース、IPv4アドレスのアクセス制御のための文字列を一覧表示します。 詳細については、[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html)の`pg_hba.conf`の項を参照してください。 ##### `ipv6acls` 接続方法、ユーザ、データベース、IPv6アドレスのアクセス制御のための文字列を一覧表示します。 詳細については、[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html)の`pg_hba.conf`の項を参照してください。 ##### `ip_mask_allow_all_users` リモート接続に関するPostgreSQLのデフォルト動作をオーバーライドします。デフォルトでは、PostgreSQLは、データベースユーザアカウントがリモートマシンからTCP経由で接続することを許可しません。許可するには、この設定をオーバーライドします。 データベースユーザによる任意のリモートマシンからの接続を許可するには、'0.0.0.0/0'に設定します。ローカルの'192.168'サブネット内の任意のマシンからの接続を許可するには、'192.168.0.0/1'に設定します。 デフォルト値: '127.0.0.1/32'。 ##### `ip_mask_deny_postgres_user` postgresスーパーユーザについて、リモート接続を拒否するためのIPマスクを指定します。 デフォルト値: '0.0.0.0/0'。デフォルト値ではリモート接続はすべて拒否されます。 ##### `locale` このモジュールで作成されるすべてのデータベースのデフォルトのデータベースロケールを設定します。オペレーティングシステムによっては、`template1` の初期化にも使用されます。その場合、モジュール外部のデフォルトになります。 デフォルト値: `undef`、実質的には'C'。 **Debianでは、PostgreSQLの全機能を使用できるよう、'locales-all'パッケージがインストールされていることを確認してください。** ##### `manage_pg_hba_conf` `pg_hba.conf`を管理するかどうかを指定します。 `true`に設定すると、Puppetはこのファイルを上書きします。 `false`に設定すると、Puppetはこのファイルに変更を加えません。 有効な値: `true`、`false`。 デフォルト値: `true` ##### `manage_pg_ident_conf` pg_ident.confファイルを上書きします。 `true`に設定すると、Puppetはこのファイルを上書きします。 `false`に設定すると、Puppetはこのファイルに変更を加えません。 有効な値: `true`、`false`。 デフォルト値: `true`。 ##### `manage_recovery_conf` `recovery.conf`を管理するかどうかを指定します。 `true`に設定すると、Puppetはこのファイルを上書きします。 有効な値: `true`、`false`。 デフォルト値: `false`。 ##### `needs_initdb` サーバーパッケージをインストール後、PostgreSQLサービスを開始する前に、`initdb`動作を明示的に呼び出します。 デフォルト値: OSによって異なります。 ##### `package_ensure` サーバーインスタンスを作成するときに、`package`リソースに値を受け渡します。 デフォルト値: `undef`。 ##### `package_name` サーバーソフトウェアをインストールするときに使用するパッケージの名前を指定します。 デフォルト値: OSによって異なります。 ##### `pg_hba_conf_defaults` `false`に設定すると、`pg_hba.conf`についてモジュールに設定されたデフォルト値を無効にします。これは、デフォルト値を使用せずにオーバーライドするときに役立ちます。だし、基本的な`psql`動作などを実行するには一定のアクセスが要求されるので、ここでの変更内容がその他のモジュールと矛盾しないように注意してください。 ##### `pg_hba_conf_path` `pg_hba.conf`ファイルへのパスを指定します。 ##### `pg_ident_conf_path` `pg_ident.conf`ファイルへのパスを指定します。 デフォルト値: '${confdir}/pg_ident.conf'。 ##### `plperl_package_name` PL/Perl拡張のデフォルトパッケージ名を設定します。 デフォルト値: OSによって異なります。 ##### `plpython_package_name` PL/Python拡張のデフォルトパッケージ名を設定します。 デフォルト値: OSによって異なります。 ##### `port` PostgreSQLサーバーがリッスンするポートを指定します。**注意:** サーバーがリッスンする全IPアドレスで、同一のポート番号が使用されます。また、Red Hatシステムと初期のDebianシステムでは、ポート番号を変更するとき、変更実行前にサーバーが完全停止します。 デフォルト値: 5432。これは、PostgresサーバーがTCPポート5432をリッスンすることを意味します。 ##### `postgres_password` postgresユーザのパスワードを特定の値に設定します。デフォルトでは、この設定はPostgresデータベース内のスーパーユーザアカウント(ユーザ名`postgres`、パスワードなし)を使用します。 デフォルト値: `undef`。 ##### `postgresql_conf_path` `postgresql.conf`ファイルへのパスを指定します。 デフォルト値: '${confdir}/postgresql.conf'。 ##### `psql_path` `psql`コマンドへのパスを指定します。 デフォルト値: OSによって異なります。 ##### `service_manage` Puppetがサービスを管理するかどうかを定義します。 デフォルト値: `true`。 ##### `service_name` デフォルトのPostgreSQLサービス名をオーバーライドします。 デフォルト値: OSによって異なります。 ##### `service_provider` デフォルトのPostgreSQLサービスプロバイダをオーバーライドします。 デフォルト値: `undef`。 ##### `service_reload` PostgreSQLサービスのデフォルトのリロードコマンドをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `service_restart_on_change` 設定変更をアクティブにするためにサービスの再起動が必要な設定エントリが変更された場合に、PostgreSQLサービスを再起動する際のデフォルト動作をオーバーライドします。 デフォルト値: `true`。 ##### `service_status` PostgreSQLサービスのデフォルトのステータスチェックコマンドをオーバーライドします。 デフォルト値: OSによって異なります。 ##### `user` ファイルシステム内のPostgreSQL関連ファイルのデフォルトのPostgreSQLスーパーユーザおよび所有者をオーバーライドします。 デフォルト値: 'postgres'。 #### postgresql::server::contrib PostgreSQL contribパッケージをインストールします。 ##### `package_ensure` PostgreSQL contribパッケージリソースに受け渡されたensureパラメータを設定します。 ##### `package_name` PostgreSQL contribパッケージの名前。 #### postgresql::server::plperl postgresqlのPL/Perl手続き型言語をインストールします。 ##### `package_ensure` PostgreSQL PL/Perlパッケージリソースに受け渡されたensureパラメータ。 ##### `package_name` PostgreSQL PL/Perlパッケージの名前。 #### postgresql::server::postgis PostgreSQL postgisパッケージをインストールします。 ### 定義できるタイプ #### postgresql::server::config_entry `postgresql.conf`設定ファイルを変更します。 各リソースは、次の例のようにファイル内の各行にマッピングされています。 ```puppet postgresql::server::config_entry { 'check_function_bodies': value => 'off', } ``` ##### `ensure` 'absent'に設定した場合、エントリを削除します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 ##### `value` 設定の値を定義します。 #### postgresql::server::db ローカルのデータベース、ユーザを作成し、必要なパーミッションを割り当てます。 ##### `comment` PostgreSQLのCOMMENTコマンドを使用して、データベースについて保存するコメントを定義します。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `dbname` 作成するデータベースの名前を設定します。 デフォルト値: namevar。 ##### `encoding` データベースの作成中の文字セットをオーバーライドします。 デフォルト値: インストール時に定義されたデフォルト値。 ##### `grant` 作成中に付与するパーミッションを指定します。 デフォルト値: 'ALL'。 ##### `istemplate` -`true`に設定すると、そのデータベースをテンプレートとして指定します。 +`true`に設定すると、そのデータベースをテンプレートとして指定します。 デフォルト値: `false`。 ##### `locale` データベース作成中にロケールをオーバーライドします。 デフォルト値: インストール時に定義されたデフォルト値。 ##### `owner` ユーザをデータベースの所有者として設定します。 デフォルト値: `postgresql::server`または`postgresql::globals`で設定された'$user'変数。 ##### `password` **必須** 作成されたユーザのパスワードを設定します。 ##### `tablespace` 作成したデータベースを割り当てるテーブル空間の名前を定義します。 デフォルト値: PostgreSQLのデフォルト値。 ##### `template` このデータベースを構築する際にテンプレートとして使用するデータベースの名前を指定します。 デフォルト値: `template0`。 ##### `user` データベースを作成し、作成後にデータベースへのアクセスを割り当てるユーザ。必須指定です。 #### postgresql::server::database ユーザなし、パーミッションなしのデータベースを作成します。 ##### `dbname` データベースの名前を設定します。 デフォルト値: namevar。 ##### `encoding` データベースの作成中の文字セットをオーバーライドします。 デフォルト値: インストール時に定義されたデフォルト値。 ##### `istemplate` `true`に設定すると、そのデータベースをテンプレートとして定義します。 デフォルト値: `false`。 ##### `locale` データベース作成中にロケールをオーバーライドします。 デフォルト値: インストール時に定義されたデフォルト値。 ##### `owner` データベース所有者の名前を設定します。 デフォルト値: `postgresql::server`または`postgresql::globals`で設定された'$user'変数。 ##### `tablespace` このデータベースを作成するテーブル空間を設定します。 デフォルト値: インストール時に定義されたデフォルト値。 ##### `template` このデータベースを構築する際にテンプレートとして使用するデータベースの名前を指定します。 デフォルト値: 'template0'。 #### postgresql::server::database_grant データベース固有のパーミッションについて`postgresql::server::database_grant`をラッピングして、grantベースのユーザアクセス権を管理します。詳細については、[PostgreSQLマニュアルの`grant`](http://www.postgresql.org/docs/current/static/sql-grant.html)を参照してください。 #### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `db` アクセス権を付与するデータベースを指定します。 ##### `privilege` 付与する権限のコンマ区切りリストを指定します。 有効なオプション: 'ALL'、'CREATE'、'CONNECT'、'TEMPORARY'、'TEMP'。 ##### `psql_db` 権限付与を実行するデータベースを定義します。 **通常、デフォルトを変更しないでください。** デフォルト値: 'postgres'。 ##### `psql_user` `psql`を実行するOSユーザを指定します。 デフォルト値: モジュールのデフォルトユーザ。通常、'postgres'。 ##### `role` アクセスを付与するロールまたはユーザを指定します。 #### postgresql::server::extension PostgreSQL拡張を管理します。 ##### `database` 拡張を有効化するデータベースを指定します。 ##### `schema` 拡張を有効化するスキーマを指定します。 ##### `ensure` 拡張を有効化するか無効化するかを指定します。 有効なオプション: 'present'または'absent'。 #### `extension` 有効化する拡張を指定します。空欄にした場合、リソースの名前が使用されます。 #### `version` データベースが使用するエクステンションのバージョンを指定します。 拡張パッケージが更新された場合、各データベースで有効なバージョンを自動的に変更することはありません。 そのためには、PostgreSQLに固有のSQL `ALTER EXTENSION...`を使用して更新する必要があります `version`は`latest`に設定できます。この場合、SQL `ALTER EXTENSION "extension" UPDATE`がこのデータベースのみに適用されます。 `version`は特定のバージョンに設定できます。この場合、拡張は`ALTER EXTENSION "extension" UPDATE TO 'version'`を使用して更新されます 例えば、拡張を`postgis`、バージョンを`2.3.3`に設定した場合、SQL `ALTER EXTENSION "postgis" UPDATE TO '2.3.3'`がこのデータベースのみに適用されます。 `version`は省略される場合もあります。この場合、SQL `ALTER EXTENSION...`は適用されません。バージョンは変更されず、そのままになります。 ##### `package_name` 拡張を有効化する前にインストールするパッケージを指定します。 ##### `package_ensure` デフォルトのパッケージ削除動作をオーバーライドします。 デフォルトでは、`package_name`で指定されたパッケージが、拡張が有効のときインストールされ、拡張が無効のとき削除されます。この動作をオーバーライドするには、そのパッケージに`ensure`の値を設定してください。 #### postgresql::server::grant ロールのgrantベースのアクセス権を管理します。詳細については、[PostgreSQLマニュアルの`grant`](http://www.postgresql.org/docs/current/static/sql-grant.html)を参照してください。 ##### `db` アクセス権を付与するデータベースを指定します。 ##### `object_type` 権限を付与するオブジェクトのタイプを指定します。 有効なオプション: 'DATABASE'、'SCHEMA'、'SEQUENCE'、'ALL SEQUENCES IN SCHEMA'、'TABLE'、または'ALL TABLES IN SCHEMA'。 ##### `object_name` アクセス権を付与する`object_type`の名前を、文字列または2要素の配列で指定します。 String: 'object_name' Array: ['schema_name', 'object_name'] ##### `port` 接続に使用するポート。 デフォルト値: `undef`。PostgreSQLのパッケージングに応じて、通常、デフォルトでポート5432になります。 ##### `privilege` 付与する権限を指定します。 有効なオプション: 'ALL'、'ALL PRIVILEGES'、または'object_type'依存の文字列。 ##### `psql_db` 権限付与を実行するデータベースを指定します。 **通常、デフォルトを変更しないでください。** デフォルト値: 'postgres'。 ##### `psql_user` `psql`を実行するOSユーザを設定します。 デフォルト値: モジュールのデフォルトユーザ。通常、'postgres'。 ##### `role` アクセスを付与するロールまたはユーザを指定します。 #### postgresql::server::grant_role ロールを(グループ)ロールに割り当てられるようにします。詳細については、[PostgreSQLマニュアルの`Role Membership`](http://www.postgresql.org/docs/current/static/role-membership.html)を参照してください。 ##### `group` ロールを割り当てるグループロールを指定します。 ##### `role` グループに割り当てるロールを指定します。空欄にした場合、リソースの名前が使用されます。 ##### `ensure` メンバーシップを付与するか、無効化するかを指定します。 有効なオプション: 'present'または'absent'。 デフォルト値: 'present'。 ##### `port` 接続に使用するポート。 デフォルト値: `undef`。PostgreSQLのパッケージングに応じて、通常、デフォルトでポート5432になります。 ##### `psql_db` 権限付与を実行するデータベースを指定します。 **通常、デフォルトを変更しないでください。** デフォルト値: 'postgres'。 ##### `psql_user` `psql`を実行するOSユーザを設定します。 デフォルト値: モジュールのデフォルトユーザ。通常、`postgres`。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 #### postgresql::server::pg_hba_rule `pg_hba.conf`のアクセスルールを作成できるようにします。詳細については、[使用例](#create-an-access-rule-for-pghba.conf)および[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html)を参照してください。 ##### `address` タイプが'local'ではないとき、このルール一致に対するCIDRベースのアドレスを設定します。 ##### `auth_method` このルールが一致する接続の認証に使用される方法を提供します。詳細な説明は、PostgreSQL `pg_hba.conf`のマニュアルに記載されています。 ##### `auth_option` 特定の`auth_method`設定については、受け渡し可能な追加オプションがあります。詳細については、PostgreSQL `pg_hba.conf`マニュアルを参照してください。 ##### `database` このルールが一致するデータベースのコンマ区切りリストを設定します。 ##### `description` 必要に応じて、このルールの長めの説明を定義します。この説明は、`pg_hba.conf`のルール上部のコメント内に挿入されます。 デフォルト値: 'none'。 そのリソースを一意に識別するための方法を指定しますが、機能的には何も実行しません。 ##### `order` `pg_hba.conf`にルールを配置する順序を設定します。 デフォルト値: 150。 #### `postgresql_version` PostgreSQLインスタンス全体を管理することなく、`pg_hba.conf`を管理します。 デフォルト値: `postgresql::server`に設定されたバージョン。 ##### `target` ルールのターゲットを提供します。通常、内部使用のみのプロパティです。 **注意して使用してください。** ##### `type` ルールのタイプを設定します。 有効なオプション: 'local'、'host'、'hostssl'、または'hostnossl'。 ##### `user` このルールが一致するユーザのコンマ区切りリストを設定します。 #### postgresql::server::pg_ident_rule `pg_ident.conf`のユーザ名マップを作成可能にします。詳細については、上述の[使用例](#create-user-name-maps-for-pgidentconf)および[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/auth-username-maps.html)を参照してください。 ##### `database_username` データベースユーザのユーザ名を指定します。このユーザ名には`system_username`がマッピングされています。 ##### `description` 必要に応じて、このルールの長めの説明を設定します。この説明は、`pg_ident.conf`のルール上部のコメント内に挿入されます。 デフォルト値: 'none'。 ##### `map_name` `pg_hba.conf`でこのマッピングを参照するために使用されるユーザマップの名前を設定します。 ##### `order` `pg_ident.conf`にマッピングを配置する際の順序を定義します。 デフォルト値: 150。 ##### `system_username` オペレーティングシステムのユーザ名(データベースへの接続に使用するユーザ名)を指定します。 ##### `target` ルールのターゲットを提供します。通常、内部使用のみのプロパティです。 **注意して使用してください。** #### postgresql::server::reassign_owned_by PostgreSQLコマンド'REASSIGN OWNED'をデータベースに対して実行し、既存オブジェクトの所有権を別のデータベースロールに移します。 ##### `db`  'REASSIGN OWNED'コマンドを適用するデータベースを指定します。 ##### `old_role` 指定したデータベース内のオブジェクトを現在所有しているロールまたはユーザを指定します。 ##### `new_role` 対象オブジェクトの新しい所有者となるロールまたはユーザを指定します。 ##### `psql_user` `psql`を実行するOSユーザを指定します。 デフォルト値: モジュールのデフォルトユーザ。通常、'postgres'。 ##### `port` 接続に使用するポート。 デフォルト値: `undef`。PostgreSQLのパッケージングに応じて、通常、デフォルトでポート5432になります。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 #### postgresql::server::recovery `recovery.conf`の内容を作成可能にします。詳細については、[使用例](#create-recovery-configuration)および[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/recovery-config.html)を参照してください。 `recovery_target_inclusive`、 `pause_at_recovery_target`、`standby_mode`、`recovery_min_apply_delay`を除くすべてのパラメータ値は、テンプレートに含まれる文字列セットです。 全パラメータリストの詳細な説明は、[PostgreSQLマニュアル](http://www.postgresql.org/docs/current/static/recovery-config.html)にあります。 パラメータは、次の3つのセクションにグループ分けされています。 ##### [アーカイブリカバリパラメータ](http://www.postgresql.org/docs/current/static/archive-recovery-settings.html) * `restore_command` * `archive_cleanup_command` * `recovery_end_command` ##### [Recovery Target Settings](http://www.postgresql.org/docs/current/static/recovery-target-settings.html) * `recovery_target_name` * `recovery_target_time` * `recovery_target_xid` * `recovery_target_inclusive` * `recovery_target` * `recovery_target_timeline` * `pause_at_recovery_target` ##### [Standby Server Settings](http://www.postgresql.org/docs/current/static/standby-settings.html) * `standby_mode`: 文字列('on'/'off')またはブール値(`true`/`false`)で指定できます。 * `primary_conninfo` * `primary_slot_name` * `trigger_file` * `recovery_min_apply_delay` ##### `target` ルールのターゲットを提供します。通常、内部使用のみのプロパティです。 **注意して使用してください。** #### postgresql::server::role PostgreSQLのロールまたはユーザを作成もしくは削除します。 ##### `ensure` ロールを作成するか削除するかを指定します。 'present'を指定するとロールが作成され、'absent'を指定するとロールが削除されます。 デフォルト値: 'present'。 ##### `connection_limit` ロールが同時に接続可能な数を指定します。 デフォルト値: '-1'。これは、無制限を意味します。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `createdb` このロールに新しいデータベースを作成する能力を付与するかどうかを指定します。 デフォルト値: `false`。 ##### `createrole` このロールに新しいロールを作成する権限を付与するかどうかを指定します。 デフォルト値: `false`。 ##### `inherit` 新しいロールに継承権限を付与するかどうかを指定します。 デフォルト値: `true`。 ##### `login` 新しいロールにログイン権限を付与するかどうかを指定します。 デフォルト値: `true`。 ##### `password_hash` パスワード作成中に使用するハッシュを設定します。PostgreSQLがサポートする形式でパスワードが暗号化されていない場合、ここで、`postgresql_password`関数を使用して、MD5ハッシュを提供します。例は次のとおりです。 ##### `update_password` trueに設定すると、変更時にパスワードが更新されます。作成後にロールのパスワードを変更しない場合は、falseに設定してください。 ```puppet postgresql::server::role { 'myusername': password_hash => postgresql_password('myusername', 'mypassword'), } ``` ##### `replication` `true`に設定すると、このロールにレプリケーション機能が提供されます。 デフォルト値: `false`。 ##### `superuser` 新しいロールにスーパーユーザ権限を付与するかどうかを指定します。 デフォルト値: `false`。 ##### `username` 作成するロールのユーザ名を定義します。 デフォルト値: namevar。 #### postgresql::server::schema スキーマを作成します。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `db` 必須。 このスキーマを作成するデータベースの名前を設定します。 ##### `owner` スキーマのデフォルト所有者を設定します。 ##### `schema` スキーマの名前を設定します。 デフォルト値: namevar。 #### postgresql::server::table_grant ユーザのgrantベースのアクセス権を管理します。詳細については、PostgreSQLマニュアルの`grant`の項を参照してください。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `db` そのテーブルが存在するデータベースを指定します。 ##### `privilege` 付与する権限のコンマ区切りリストを指定します。有効なオプション: 'ALL'、'SELECT'、'INSERT'、'UPDATE'、'DELETE'、'TRUNCATE'、'REFERENCES'、'TRIGGER'。 ##### `psql_db` 権限付与を実行するデータベースを指定します。 通常、デフォルトを変更しないでください。 デフォルト値: 'postgres'。 ##### `psql_user` `psql`を実行するOSユーザを指定します。 デフォルト値: モジュールのデフォルトユーザ。通常、'postgres'。 ##### `role` アクセスを付与するロールまたはユーザを指定します。 ##### `table` アクセス権を付与するテーブルを指定します。 #### postgresql::server::tablespace テーブル空間を作成します。必要な場合、場所も作成し、PostgreSQLサーバーと同じパーミッションを割り当てます。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。 デフォルト値: ローカルのPostgresインスタンスに接続します。 ##### `location` このテーブル空間へのパスを指定します。 ##### `owner` そのテーブル空間のデフォルト所有者を指定します。 ##### `spcname` テーブル空間の名前を指定します。 デフォルト値: namevar。 ### タイプ #### postgresql_psql Puppetがpsqlステートメントを実行できるようにします。 ##### `command` 必須。 psqlを介して実行するSQLコマンドを指定します。 ##### `cwd` psqlコマンドが実行される作業ディレクトリを指定します。 デフォルト値: '/tmp'。 ##### `db` SQLコマンドを実行するデータベースの名前を指定します。 ##### `environment` SQLコマンドに対して追加の環境変数を設定する場合に指定します。複数の環境変数を使用する場合は、配列として指定します。 ##### `name` 自身の参考用の任意のタグ、すなわちメッセージの名前を設定します。これはnamevarです。 ##### `onlyif` メインのコマンドの前に実行するオプションのSQLコマンドを設定します。通常、これはべき等性に基づいて、データベース内のオブジェクトの存在を確認し、メインのSQLコマンドを実行する必要があるかどうかを判断するため使用されます。 ##### `port` SQLコマンドを実行するデータベースサーバーのポートを指定します。 ##### `psql_group` psqlコマンドを実行するシステムユーザグループアカウントを指定します。 デフォルト値: 'postgres'。 ##### `psql_path` psql実行ファイルへのパスを指定します。 デフォルト値: 'psql'。 ##### `psql_user` psqlコマンドを実行するシステムユーザアカウントを指定します。 デフォルト値: 'postgres'。 ##### `refreshonly` notifyイベントまたはsubscribeイベントが発生したときのみSQLを実行するかどうかを指定します。 有効な値: `true`、`false`。 デフォルト値: `false`。 ##### `search_path` SQLコマンドを実行するときに使用するスキーマ検索パスを定義します。 ##### `unless` `onlyif`の逆です。 #### postgresql_conf Puppetが`postgresql.conf`パラメータを管理できるようにします。 ##### `name` 管理するPostgreSQLパラメータ名を指定します。 これはnamevarです。 ##### `target` `postgresql.conf`へのパスを指定します。 デフォルト値: '/etc/postgresql.conf'。 ##### `value` このパラメータに設定する値を指定します。 #### postgresql_replication_slot PostgreSQLマスターサーバー上でウォームスタンバイレプリケーションを登録するためのレプリケーションスロットを作成および消去できるようにします。 ##### `name` 作成するスロットの名前を指定します。有効なレプリケーションスロット名である必要があります。 これはnamevarです。 ##### `ensure` 必須。 指定されたスロットに対して、作成または消去のいずれかのアクションを指定します。 有効な値: 'present'、'absent'。 デフォルト値: 'present'。 #### postgresql_conn_validator このタイプを使用するローカルまたはリモートのPostgreSQLデータベースへの接続を検証します。 ##### `connect_settings` リモートサーバーへの接続時に使用する環境変数のハッシュを指定します。個々のパラメータ(`host`など)を設定する代わりに使用されますが、個々のパラメータが設定されている場合は個々のパラメータが優先されます。 デフォルト値: {} ##### `db_name` テストするデータベースの名前を指定します。Specifies the name of the database you wish to test. デフォルト値: '' ##### `db_password` 接続するパスワードを指定します。`.pgpass`が使用されている場合は空欄にできます。それ以外の場合、空欄にすることは推奨されません。 デフォルト値: '' ##### `db_username` 接続するユーザ名を指定します。 デフォルト値: '' Unixソケットとident認証を使用するとき、このユーザとして実行されます。 ##### `command` 接続性を検証するためにターゲットデータベースで実行されるコマンドです。 デフォルト値: 'SELECT 1' ##### `host` テストするデータベースのホスト名を設定します。 デフォルト値: ''。これは、通常指定されたローカルUnixソケットを使用します。 **ホストがリモートの場合、ユーザ名を指定する必要があります。** ##### `port` 接続するときに使用するポートを定義します。 -デフォルト値: '' +デフォルト値: '' ##### `run_as` `psql`コマンドの実行ユーザを指定します。これは、Unixソケットと`ident`認証を使用してローカルにデータベースに接続するときに重要です。リモートテストには必要ありません。 ##### `sleep` 失敗した後、再試行する前にスリープする時間を秒単位で設定します。 ##### `tries` 失敗した後、リソースを失敗とみなすまで再試行する回数を設定します。 ### 関数 #### postgresql_password PostgreSQL暗号化パスワードを生成します。次のように、`postgresql_password`をコマンドラインから呼び出し、暗号化されたパスワードをマニフェストにコピーペーストします。 ```shell puppet apply --execute 'notify { 'test': message => postgresql_password('username', 'password') }' ``` 本番マニフェストからこの関数を呼び出すことも可能ですが、その場合、マニフェストには暗号化していない平文のパスワードを含める必要があります。 #### postgresql_acls_to_resources_hash(acl_array, id, order_offset) この内部関数は、`pg_hba.conf`ベースのACLのリスト(文字列の配列として受け渡されたもの)を`postgresql::pg_hba_rule`リソースと互換性のある形式に変換します。 **この関数は、モジュールによる内部的な使用のみ可能です。** ### タスク postgresqlモジュールの'sqlサンプルタスクは、データベースに対して任意のSQLを実行します。タスクの実行方法については、[Puppet Enterpriseマニュアル](https://puppet.com/docs/pe/2017.3/orchestrator/running_tasks.html)または[Boltマニュアル](https://puppet.com/docs/bolt/latest/bolt.html)を参照してください。 ## 制約事項 PostgreSQLのバージョン8.1~9.5で動作します。 現在、postgresqlモジュールは次のオペレーティングシステムでテスト済みです。 * Debian 6.x, 7.x, 8.x. * CentOS 5.x、6.x、7.x。 * Ubuntu 10.04および12.04、14.04。 その他のシステムとも互換性がある可能性がありますが、積極的なテストは行っておりません。 ### Aptモジュールのサポート このモジュールは1.xと2.x両方のバージョンの`puppetlabs-apt` モジュールをサポートしていますが、2.0.0と2.0.1の`puppetlabs-apt`はサポートしていません。 ### PostGISのサポート PostGISは、現時点ではすべてのプラットフォームで正常に動作するわけではないため、サポート対象外の機能とみなします。 ### すべてのバージョンのRHEL/CentOS SELinuxが有効化されている場合、次の方法で`postgresql_port_t`コンテキストに使用中のカスタムポートを追加する必要があります。 ```shell semanage port -a -t postgresql_port_t -p tcp $customport ``` ## 開発 Puppet Forgeに公開されているPuppet Labsモジュールはオープンプロジェクトのため、維持するにはコミュニティの貢献が不可欠です。Puppetは、現在私たちがアクセスできない無数のプラットフォームやハードウェア、ソフトウェア、デプロイ構成にも利用されることを目的としています。私たちの目標は、できる限り簡単に変更に貢献し、みなさまの環境で私たちのモジュールが機能できるようにすることです。最高の状態を維持するため、コントリビュータにはいくつかのガイドラインを守っていただく必要があります。詳細については、[モジュールコントリビューションガイド](https://docs.puppetlabs.com/forge/contributing.html)を参照してください。 ### テスト このモジュールには、2種類のテストが配布されています。`rspec-puppet`のユニットテストと、`rspec-system`を使用したシステムテストです。 ユニットテストを実行するには、以下がインストールされていることを確認してください。 * rake * bundler 次のように、必要なgemをインストールします。 ```shell bundle install --path=vendor ``` そして、次のように記述して、ユニットテストを実行します。 ```shell bundle exec rake spec ``` ユニットテストは、Travis-CIでも実行されます。自身のテスト結果を確認するには、このプロジェクトのご自身のGitHubクローンのアカウントセクションから、Travis-CIを介してサービスフックを登録してください。 システムテストを実行するには、以下のツールもインストールされていることを確認してください。 * Vagrant > 1.2.x * VirtualBox > 4.2.10 次の記述を使用してテストを実行します。 ```shell bundle exec rspec spec/acceptance ``` 異なるオペレーティングシステムでテストを実行するには、`.nodeset.yml`で利用可能なセットを確認して、次の構文で特定のセットを実行します。 ```shell RSPEC_SET=debian-607-x64 bundle exec rspec spec/acceptance ``` ### コントリビュータ -貢献してくださった方々の一覧を[GitHub](https://github.com/puppetlabs/puppetlabs-postgresql/graphs/contributors)でご覧いただけます。 +貢献してくださった方々の一覧を[Github](https://github.com/puppetlabs/puppetlabs-postgresql/graphs/contributors)でご覧いただけます。