diff --git a/CHANGELOG.md b/CHANGELOG.md index a05fed5..2e06180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,980 +1,995 @@ # Change log All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). +## Supported Release [5.4.0] +### Summary +This is a minor release, it makes this module PDK-compliant for easier maintenance and includes a roll up of maintenance changes. + +#### Added +- PDK conversion [MODULES-6330](https://tickets.puppetlabs.com/browse/MODULES-6330). +- Parameter for `postgresql::server::database`: + - `ensure` Capability to revoke database privileges [PostgreSQL documentation for `grant`](http://www.postgresql.org/docs/current/static/sql-grant.html). +- Parameter for `postgresql::server::database_grant`: + - `ensure` Capability to revoke database privileges [PostgreSQL documentation for `grant`](http://www.postgresql.org/docs/current/static/sql-grant.html). + +#### Fixed +- Documentation error, `reassign_owned_by` uses `*_role` not `*_owner`. + ## Supported Release [5.3.0] ### Summary Implements rubocop changes within the module, alongside other smaller changes. #### Added - ensure=>absent added to postgresql::server:role. - Support added for Fedora 27. - scram-sha-256 added as a valid ph_hba_rule auth method. - 9.6 settings inherited for later PgSQL versions on FreeBSD. - A require has been added for puppet. #### Changed - Changes made to avoid the useless loading of files by augeas. - Modulesync changes. - psql_path defaulted to postgresql::server::psql_path. - Rubocop changes have been made. #### Removed - Debian 9 support deprecated. ## Supported Release 5.2.1 ### Summary -Bug fix for issue introduced in 5.2.0 +Bug fix for issue introduced in 5.2.0 #### Fixed - issue where the module was attempting to install extensions before a database was available. ([SERVER-2003](https://tickets.puppetlabs.com/browse/SERVER-2003)) ## Supported Release 5.2.0 ### Summary Adds several new features including some work around OS support. Also includes a couple of fixes to tests and the removal of unsupported Ubuntu versions. #### Added - Added default postgresql version of Ubuntu 17.4 version to the globals.pp file. - Fedora 26 provides postgresql-server version 9.6 by default - Added support to manifests/globals.pp to avoid puppet failures on Fedora 26 nodes. - Use postgresql 9.6 for the newest SLES and openSUSE releases. - Enhanced --data-checksums on initdb. - Added support for Debian version 9. - Added a `version` parameter. #### Changed - Replaced validate_re calls with puppet datatype `Pattern` and is_array calls with puppet datatype `Array`. - Installation method for apt in the spec_helper_acceptance, this is a temporary workaround due to issues with module installation. #### Fixed - Updated spec tests to remove deprecation warnings. - Docs formatting. - Pass default_connect_settings to validate service ([MODULES-4682](https://tickets.puppetlabs.com/browse/MODULES-4682)) - Rocket Alignment for Lint. - Fixed changes in error messages in tests ([MODULES-5378](https://tickets.puppetlabs.com/browse/MODULES-5378)) #### Removed - Removed unsupported Ubuntu versions 10.04 and 12.04 ([MODULES-5501](https://tickets.puppetlabs.com/browse/MODULES-5501)) - Removed unsupported Debian version 6. - Removed numeric order override. ## Supported Release 5.1.0 ### Summary This release includes Japanese translations for internationalization, Puppet 5 support, implementation of defined type postgresql::server::reassign_owned_by. #### Features - Updating translations for readmes/README_ja_JP.md - add defined type postgresql::server::reassign_owned_by - Allow order parameter to be string value - prep for puppet 5 ([MODULES-5144](https://tickets.puppetlabs.com/browse/MODULES-5144)) - add data_checksums option to initdb - parameter ensure of custom resource postgresql_replication_slot is not documented ([MODULES-2989](https://tickets.puppetlabs.com/browse/MODULES-2989)) #### Bug Fixes - Adding a space for header formatting - use https for apt.postgresql.org repo - msync puppet 5 and ruby 2.4 ([MODULES-5197](https://tickets.puppetlabs.com/browse/MODULES-5187)) - Only run test on postgresql >= 9.0 ([FM-6240](https://tickets.puppetlabs.com/browse/FM-6240)) - Fix Ruby 2.4 deprecation in postgresql_acls_to_resources_hash ## Supported Release 5.0.0 ### Summary This **major** release dropped support for Puppet 3 and PostgreSQL 8.x, added Puppet 4 data types, and deprecated the validate_db_connection type. #### Added - `locales/` directory, .pot file, and i18n `config.yaml`. ([FM-6116](https://tickets.puppet.com/browse/FM-6116)) - `update_password` parameter to toggle password management per role. - **Puppet 4** type validation. - new `postgresql_conn_validator` custom type and deprecated `validate_db_connection`. ([MODULES-1394](https://tickets.puppet.com/browse/MODULES-1394)) #### Changed - default postgis versions in postgresql::globals to use newer versions. - puppetlabs-concat and puppetlabs-apt dependencies to use latest versions. ([MODULES-4906](https://tickets.puppet.com/browse/MODULES-4906), [MODULES-4947](https://tickets.puppet.com/browse/MODULES-4947)) - default value for `log_line_prefix` to `undef`. - `listen_addresses` default value to 'localhost'. Allows for it to be set independently of a class declaration. - use of stdlib validate_* functions. They have been removed in favor of Puppet 4 type validation. - lower Puppet dependency in metadata to 4.7.0. ([MODULES-4826](https://tickets.puppet.com/browse/MODULES-4826)) #### Fixed - deprecated apt::source parameters(`key`,`key_source`, & `include_src`). - default SUSE parameters. ([MODULES-4598](https://tickets.puppet.com/browse/MODULES-4598)) - use of force parameter on concat resources. ## Supported Release 4.9.0 ### Summary This release adds several types and, among other bugs, fixes an issue with the yum URL. #### Features - Modifying ownership of databases and schemas now available (MODULES-3247) - Use `module_workdir` to specify a custom directory in which to execute psql commands - `grant_role` and `grant` types added! - Support for parallel unit testing (parallel_tests) - Override download/installation repo URL with `repo_baseurl` - Set your timezone with `timezone` - Grant privileges on LANGUAGEs - Added support for Debian Stretch and Ubuntu Yakkety Yak #### Bugfixes - Usernames and passwords are now converted to strings before password hash is created - Specify default database name if it is not the username - Update to yum repo - Schema name conflicts fix ## Supported Release 4.8.0 ### Summary This release primarily fixes an issue with `postgresql_conf` values of ipaddresses being considered floats and not getting quoted. #### Features - Add `default_connect_settings` parameter to `postgresql::server` - Running under strict variables is now supported - Add timestamps into logs by default #### Bugfixes - Obscure password in postgresql\_psql type - Fix ip address quoting in postgresql\_conf type - Fix handling of systemd service on Ubuntu - Mark log_min_duration_statement setting as requiring a service restart - Add fixes for Fedora 23, Fedora 24, FreeBSD, OpenBSD - Fix environment handling to avoid "Overriding environment setting" message - Work around PUP-6385, using empty arrays instead of undef when specifying resource relationships - README editorial pass - Reduce whitespace in templates - Update build/test infrastructure ## Supported Release 4.7.1 ### Summary This release contains some bugfixes and documentation updates. #### Bugfixes - (MODULES-3024) Quote database objects when creating databases. - Properly escape case where password ends with '$'. - Fixes password change when postgres is configure to non-standard port. - Unpins concat dependency to be able to use concat 2.x. - Workaround to fix installing on Amazon Linux. - Fixes proper defaulting of `$service_provider` parameter. - Fixes postgres server init script naming on Amazon Linux. - Fixes service reload parameter on Arch Linux. - Adds missing onlyif_function to sequence grant code. - Fixes to the markdown of the README. ## Supported Release 4.7.0 ### Summary A release with a considerable amount of new features, including remote db support and several platform support updates. Various bugfixes including several to address warnings and a sizable README update. #### Features - Remote DB support - Connection-settings allows a hash of options that can be used when connecting to a remote DB. - Debian 8 support. - Updated systemd-override to support fedora and CentOS paths. - Adds the ability to define the extension name separately from the title of the resource, which allows you to add the extension to more than one database. - Added parameter to disable automatic service restarts on config changes. - Ubuntu 15.10 compatibility. - OpenBSD version is now 9.4. - Added .gitattributes to maintain line endings for .sh and .rb files. - Adds default postgis version for 9.5. - Allows float postgresql_conf values. - Schedule apt update after install of repo. #### Bugfixes - Fixed systemd-override for RedHat systems with unmanaged Yum repos. - Removed inherits postgresql::params. - Multi-node tests are now not ran by default. - Change apt::pin to apt_postgresql_org to prevent error message. - Removed syntax error near UTF8. - Removal of extra blanks and backslashes in README. - Double quotes now used around database name to prevent syntax error. - Removes ruby 1.8.7 and puppet 2.7 from travis-ci jobs. - Fixed paths to work on Amazon Linux. - Fixed quotes around locale options. - Huge README update. - Update to use current msync configs. - Fixes postgresql::server acceptance test descriptions. ## Supported Release 4.6.1 ###Summary Small release for support of newer PE versions. This increments the version of PE in the metadata.json file. ## 2015-09-01 - Supported Release 4.6.0 ### Summary This release adds a proxy feature for yum, Postgis improvements, and decoupling pg_hba_rule from postgresql::server. #### Features - Support setting a proxy for yum operations - Allow for undefined PostGIS version - Decouple pg_hba_rule from postgresql::server #### Bugfixes - Fix postgis default package name on RedHat ## 2015-07-27 - Supported Release 4.5.0 ### Summary This release adds sequence grants, some postgresql 9.4 fixes, and `onlyif` to the psql resource. ### Features - Add `onlyif` parameter to `postgresql_psql` - Add unsupported compatibility with Ubuntu 15.04 - Add unsupported compatibility with SLES 11/12 and OpenSuSE 13.2 - Add `postgresql::server::grant::onlyif_exists` attribute - Add `postgresql::server::table_grant::onlyif_exists` attribute - Add granting permissions on sequences ### Bugfixes - Added docs for `postgresql::server::grant` - Fix `pg_hba_conf_defaults => false` to not disable ipv4/ipv6 acls - Fix 9.4 for `postgresql::server::pg_hba_rule` ## 2015-07-07 - Supported Release 4.4.2 ### Summary This release fixes a bug introduced in 4.4.0. #### Bugfixes - Fixes `withenv` execution under Puppet 2.7. (MODULES-2185) ## 2015-07-01 - Supported Release 4.4.1 ### Summary This release fixes RHEL 7 & Fedora with manage_package_repo switched on. #### Bugfixes - Ensure manage_package_repo variable is in scope for systemd-override file for RHEL7 ## 2015-06-30 - Supported Release 4.4.0 ### Summary This release has several new features, bugfixes, and test improvements. #### Features - Adds a resource to manage recovery.conf. - Adds a parameter that allows the specification of a validate connection script in `postgresql::client`. - Adds support for plpython package management. - Adds support for postgresql-docs management. - Adds ability to make `postgresql::server::schema` titles unique. (MODULES-2049) - Updates puppetlabs-apt module dependency to support version 2.1.0. #### Bugfixes - Fix `postgresql_psql` parameter ordering to work on OpenBSD with Future Parser - Fix setting postgres role password (MODULES-1869) - Fix execution command with puppet <3.4 (MODULES-1923) - Fix Puppet.newtype deprecation warning (MODULES-2007) - Fix systemd override for manage_repo package versions - Fix Copy snakeoil certificate and key instead of symlinking #### Test Improvements - Allows setting BEAKER and BEAKER_RSPEC versions via environment variables. - Enables Unit testing on Travis CI with Puppet 4. - Cleans up spec_helper_acceptance.rb to use new puppet_install_helper gem. ## 2015-03-24 - Supported Release 4.3.0 ### Summary This release fixes compatibility with Puppet 4 and removes opportunities for local users to view the postgresql password. It also adds a new custom resource to aid in managing replication. #### Features - Add `postgresql::server::logdir` parameter to manage the logdir - Add `environment` parameter to `postgresql_psql` - Add `postgresql_replication_slot` custom resource #### Bugfixes - Fix for Puppet 4 - Don't print postgresql\_psql password in command - Allow `postgresql::validate_db_connection` for more than one host+port+database combo - Fix service command on Debian 8 and up - Fix `postgresql::server::extension` to work with custom user/group/port - Fix `postgresql::server::initdb` to work with custom user/group/port - Fix changing template1 encoding - Fix default `postgresql::server::grant::object_name` value - Fix idempotency of granting all tables in schema with `puppet::server::grant` - Fix lint warnings - Fix apt key to use 40 character key and bump puppetlabs-apt to >= 1.8.0 < 2.0.0 ##2015-03-10 - Supported Release 4.2.0 ###Summary This release has several new features including support for server extensions, improved grant support, and a number of bugfixes. ####Features - Changes to support OpenBSD - Add `service_reload` parameter to `postgresql::server` - Add `comment` parameter to `postgresql::server::database` (MODULES-1153) - Add `postgresql::server::extension` defined type - Add postgresql versions for utopic and jessie - Update `postgresql::server::grant` to support 'GRANT SCHEMA' and 'ALL TABLES IN SCHEMA' ####Bugfixes - Lint cleanup - Remove outdated upgrade info from README - Use correct TCP port when checking password - Create role before database - Fix template1 encoding on Debian - Require server package before user permissions - Fix `service_status` default for FreeBSD to allow PostgreSQL to start the first run - Fix invalid US-ASCII byte sequence in `postgresql::server::grant` comments - Reverted to default behavior for Debian systems as `pg_config` should not be overwritten (MODULES-1485) ##2014-11-04 - Supported Release 4.1.0 ###Summary This release adds the ability to change the PGDATA directory, and also includes documentation and test updates, future parser support, and a few other new features. ####Features - Future parser support - Documentation updates - Test updates - Add a link from `/etc/sysconfig/pgsql/postgresql-${version}` to `/etc/sysconfig/pgsql/postgresql` to support init scripts from the postgresql.org repo - Add support for changing the PGDATA directory - Set default versions for Fedora 21 and FreeBSD ##2014-09-03 - Supported Release 4.0.0 ###Summary This release removes the uninstall ability from the module, removes the firewall management, overhauls all of the acceptance testing, as well as adds better support for SuSE and Fedora. ###Backwards Incompatible changes. - Uninstall code removal. - Firewall management for Postgres. - Set manage_pg_ident_conf to true. ####Uninstallation removal We rely heavily on the ability to uninstall and reinstall postgres throughout our testing code, testing features like "can I move from the distribution packages to the upstream packages through the module" and over time we've learnt that the uninstall code simply doesn't work a lot of the time. It leaves traces of postgres behind or fails to remove certain packages on Ubuntu, and generally causes bits to be left on your system that you didn't expect. When we then reinstall things fail because it's not a true clean slate, and this causes us enormous problems during test. We've spent weeks and months working on these tests and they simply don't hold up well across the full range of PE platforms. Due to all these problems we've decided to take a stance on uninstalling in general. We feel that in 2014 it's completely reasonable and normal to have a good provisioning pipeline combined with your configuration management and the "correct" way to uninstall a fully installed service like postgresql is to simply reprovision the server without it in the first place. As a general rule this is how I personally like to work and I think is a good practice. ####I'm not OK with this! We understand that there are environments and situations in which it's not easy to do that. What if you accidently deployed Postgres on 100,000 nodes? In the future we're going to take a look at building some example 'profiles' to be found under examples/ within this module that can uninstall postgres on popular platforms. These can be modified and used in your specific case to uninstall postgresql. They will be much more brute force and reliant on deleting entire directories and require you to do more work up front in specifying where things are installed but we think it'll prove to be a much cleaner mechanism for this kind of thing rather than trying to weave it into the main module logic itself. ####Features - Removal of uninstall. - Removal of firewall management. - Tests ported to rspec3. - Acceptance tests rewritten. - Add a defined type for creating database schemas. - Add a pg_ident_rule defined type. - Set manage_pg_ident_conf to true. - Manage pg_ident.conf by default. - Improve selinux support for tablespace. - Remove deprecation warnings. - Support changing PGDATA on RedHat. - Add SLES 11 support. ####Bugfixes - Link pg_config binary into /usr/bin. - Fix fedora support by using systemd. - Initdb should create xlogdir if set. - Use a regular expression to match the major OS version on Ubuntu. ##2014-07-31 - Supported Release 3.4.2 ###Summary This release fixes recent Fedora versions. ####Features ####Bugfixes - Fix Fedora. ##2014-07-15 - Supported Release 3.4.1 ###Summary This release merely updates metadata.json so the module can be uninstalled and upgraded via the puppet module command. ##2014-04-14 - Supported Release 3.4.0 ###Summary This feature rolls up several important features, the biggest being PostGIS handling and allowing `port` to be set on postgresql::server in order to change the port that Postgres listens on. We've added support for RHEL7 and Ubuntu 14.04, as well as allowing you to manage the service via `service_ensure` finally. ####Features - Added `perl_package_name` for installing bindings. - Added `service_ensure` for allowing control of services. - Added `postgis_version` and postgis class for installing postgis. - Added `port` for selecting the port Postgres runs on. - Add support for RHEL7 and Ubuntu 14.04. - Add `default_db` to postgresql::server::database. - Widen the selection of unquoted parameters in postgresql_conf{} - Require the service within postgresql::server::reload for RHEL7. - Add `inherit` to postgresql::server::role. ####Bugfixes ##2014-03-04 - Supported Release 3.3.3 ###Summary This is a supported release. This release removes a testing symlink that can cause trouble on systems where /var is on a seperate filesystem from the modulepath. ####Features ####Bugfixes ####Known Bugs * SLES is not supported. ##2014-03-04 - Supported Release 3.3.2 ###Summary This is a supported release. It fixes a problem with updating passwords on postgresql.org distributed versions of PostgreSQL. ####Bugfixes - Correct psql path when setting password on custom versions. - Documentation updates - Test updates ####Known Bugs * SLES is not supported. ##2014-02-12 - Version 3.3.1 ####Bugfix: - Allow dynamic rubygems host ##2014-01-28 - Version 3.3.0 ###Summary This release rolls up a bunch of bugfixes our users have found and fixed for us over the last few months. This improves things for 9.1 users, and makes this module usable on FreeBSD. This release is dedicated to 'bma', who's suffering with Puppet 3.4.1 issues thanks to Puppet::Util::SUIDManager.run_and_capture. ####Features - Add lc_ config entry settings - Can pass template at database creation. - Add FreeBSD support. - Add support for customer `xlogdir` parameter. - Switch tests from rspec-system to beaker. (This isn't really a feature) ####Bugfixes - Properly fix the deprecated Puppet::Util::SUIDManager.run_and_capture errors. - Fix NOREPLICATION option for Postgres 9.1 - Wrong parameter name: manage_pg_conf -> manage_pg_hba_conf - Add $postgresql::server::client_package_name, referred to by install.pp - Add missing service_provider/service_name descriptions in ::globals. - Fix several smaller typos/issues throughout. - Exec['postgresql_initdb'] needs to be done after $datadir exists - Prevent defined resources from floating in the catalog. - Fix granting all privileges on a table. - Add some missing privileges. - Remove deprecated and unused concat::fragment parameters. ##2013-11-05 - Version 3.2.0 ###Summary Add's support for Ubuntu 13.10 (and 14.04) as well as x, y, z. ####Features - Add versions for Ubuntu 13.10 and 14.04. - Use default_database in validate_db_connection instead of a hardcoded 'postgres' - Add globals/params layering for default_database. - Allow specification of default database name. ####Bugs - Fixes to the README. ##2013-10-25 - Version 3.1.0 ###Summary This is a minor feature and bug fix release. Firstly, the postgresql_psql type now includes a new parameter `search_path` which is equivalent to using `set search_path` which allows you to change the default schema search path. The default version of Fedora 17 has now been added, so that Fedora 17 users can enjoy the module. And finally we've extended the capabilities of the defined type postgresql::validate_db_connection so that now it can handle retrying and sleeping between retries. This feature has been monopolized to fix a bug we were seeing with startup race conditions, but it can also be used by remote systems to 'wait' for PostgreSQL to start before their Puppet run continues. ####Features - Defined $default_version for Fedora 17 (Bret Comnes) - add search_path attribute to postgresql_psql resource (Jeremy Kitchen) - (GH-198) Add wait and retry capability to validate_db_connection (Ken Barber) ####Bugs - enabling defined postgres user password without resetting on every puppet run (jonoterc) - periods are valid in configuration variables also (Jeremy Kitchen) - Add zero length string to join() function (Jarl Stefansson) - add require of install to reload class (cdenneen) - (GH-198) Fix race condition on postgresql startup (Ken Barber) - Remove concat::setup for include in preparation for the next concat release (Ken Barber) ##2013-10-14 - Version 3.0.0 Final release of 3.0, enjoy! ##2013-10-14 - Version 3.0.0-rc3 ###Summary Add a parameter to unmanage pg_hba.conf to fix a regression from 2.5, as well as allowing owner to be passed into x. ####Features - `manage_pg_hba_conf` parameter added to control pg_hba.conf management. - `owner` parameter added to server::db. ##2013-10-09 - Version 3.0.0-rc2 ###Summary A few bugfixes have been found since -rc1. ####Fixes - Special case for $datadir on Amazon - Fix documentation about username/password for the postgresql_hash function ##2013-10-01 - Version 3.0.0-rc1 ###Summary Version 3 was a major rewrite to fix some internal dependency issues, and to make the new Public API more clear. As a consequence a lot of things have changed for version 3 and older revisions that we will try to outline here. (NOTE: The format of this CHANGELOG differs to normal in an attempt to explain the scope of changes) * Server specific objects now moved under `postgresql::server::` namespace: To restructure server specific elements under the `postgresql::server::` namespaces the following objects were renamed as such: `postgresql::database` -> `postgresql::server::database` `postgresql::database_grant` -> `postgresql::server::database_grant` `postgresql::db` -> `postgresql::server::db` `postgresql::grant` -> `postgresql::server::grant` `postgresql::pg_hba_rule` -> `postgresql::server::pg_hba_rule` `postgresql::plperl` -> `postgresql::server::plperl` `postgresql::contrib` -> `postgresql::server::contrib` `postgresql::role` -> `postgresql::server::role` `postgresql::table_grant` -> `postgresql::server::table_grant` `postgresql::tablespace` -> `postgresql::server::tablespace` * New `postgresql::server::config_entry` resource for managing configuration: Previously we used the `file_line` resource to modify `postgresql.conf`. This new revision now adds a new resource named `postgresql::server::config_entry` for managing this file. For example: ```puppet postgresql::server::config_entry { 'check_function_bodies': value => 'off', } ``` If you were using `file_line` for this purpose, you should change to this new methodology. * `postgresql_puppet_extras.conf` has been removed: Now that we have a methodology for managing `postgresql.conf`, and due to concerns over the file management methodology using an `exec { 'touch ...': }` as a way to create an empty file the existing postgresql\_puppet\_extras.conf file is no longer managed by this module. If you wish to recreate this methodology yourself, use this pattern: ```puppet class { 'postgresql::server': } $extras = "/tmp/include.conf" file { $extras: content => 'max_connections = 123', notify => Class['postgresql::server::service'], }-> postgresql::server::config_entry { 'include': value => $extras, } ``` * All uses of the parameter `charset` changed to `encoding`: Since PostgreSQL uses the terminology `encoding` not `charset` the parameter has been made consisent across all classes and resources. * The `postgresql` base class is no longer how you set globals: The old global override pattern was less then optimal so it has been fixed, however we decided to demark this properly by specifying these overrides in the class `postgresql::global`. Consult the documentation for this class now to see what options are available. Also, some parameter elements have been moved between this and the `postgresql::server` class where it made sense. * `config_hash` parameter collapsed for the `postgresql::server` class: Because the `config_hash` was really passing data through to what was in effect an internal class (`postgresql::config`). And since we don't want this kind of internal exposure the parameters were collapsed up into the `postgresql::server` class directly. * Lots of changes to 'private' or 'undocumented' classes: If you were using these before, these have changed names. You should only use what is documented in this README.md, and if you don't have what you need you should raise a patch to add that feature to a public API. All internal classes now have a comment at the top indicating them as private to make sure the message is clear that they are not supported as Public API. * `pg_hba_conf_defaults` parameter included to turn off default pg\_hba rules: The defaults should be good enough for most cases (if not raise a bug) but if you simply need an escape hatch, this setting will turn off the defaults. If you want to do this, it may affect the rest of the module so make sure you replace the rules with something that continues operation. * `postgresql::database_user` has now been removed: Use `postgresql::server::role` instead. * `postgresql::psql` resource has now been removed: Use `postgresql_psql` instead. In the future we may recreate this as a wrapper to add extra capability, but it will not match the old behaviour. * `postgresql_default_version` fact has now been removed: It didn't make sense to have this logic in a fact any more, the logic has been moved into `postgresql::params`. * `ripienaar/concat` is no longer used, instead we use `puppetlabs/concat`: The older concat module is now deprecated and moved into the `puppetlabs/concat` namespace. Functionality is more or less identical, but you may need to intervene during the installing of this package - as both use the same `concat` namespace. --- ##2013-09-09 Release 2.5.0 ###Summary The focus of this release is primarily to capture the fixes done to the types and providers to make sure refreshonly works properly and to set the stage for the large scale refactoring work of 3.0.0. ####Features ####Bugfixes - Use boolean for refreshonly. - Fix postgresql::plperl documentation. - Add two missing parameters to config::beforeservice - Style fixes ##2013-08-01 Release 2.4.1 ###Summary This minor bugfix release solves an idempotency issue when using plain text passwords for the password_hash parameter for the postgresql::role defined type. Without this, users would continually see resource changes everytime your run Puppet. ####Bugfixes - Alter role call not idempotent with cleartext passwords (Ken Barber) ##2013-07-19 Release 2.4.0 ###Summary This updates adds the ability to change permissions on tables, create template databases from normal databases, manage PL-Perl's postgres package, and disable the management of `pg_hba.conf`. ####Features - Add `postgresql::table_grant` defined resource - Add `postgresql::plperl` class - Add `manage_pg_hba_conf` parameter to the `postgresql::config` class - Add `istemplate` parameter to the `postgresql::database` define ####Bugfixes - Update `postgresql::role` class to be able to update roles when modified instead of only on creation. - Update tests - Fix documentation of `postgresql::database_grant` ##2.3.0 This feature release includes the following changes: * Add a new parameter `owner` to the `database` type. This can be used to grant ownership of a new database to a specific user. (Bruno Harbulot) * Add support for operating systems other than Debian/RedHat, as long as the user supplies custom values for all of the required paths, package names, etc. (Chris Price) * Improved integration testing (Ken Barber) ##2.2.1 This release fixes a bug whereby one of our shell commands (psql) were not ran from a globally accessible directory. This was causing permission denied errors when the command attempted to change user without changing directory. Users of previous versions might have seen this error: Error: Error executing SQL; psql returned 256: 'could not change directory to "/root" This patch should correct that. #### Detail Changes * Set /tmp as default CWD for postgresql_psql ##2.2.0 This feature release introduces a number of new features and bug fixes. First of all it includes a new class named `postgresql::python` which provides you with a convenient way of install the python Postgresql client libraries. class { 'postgresql::python': } You are now able to use `postgresql::database_user` without having to specify a password_hash, useful for different authentication mechanisms that do not need passwords (ie. cert, local etc.). We've also provided a lot more advanced custom parameters now for greater control of your Postgresql installation. Consult the class documentation for PuppetDB in the README. This release in particular has largely been contributed by the community members below, a big thanks to one and all. #### Detailed Changes * Add support for psycopg installation (Flaper Fesp and Dan Prince) * Added default PostgreSQL version for Ubuntu 13.04 (Kamil Szymanski) * Add ability to create users without a password (Bruno Harbulot) * Three Puppet 2.6 fixes (Dominic Cleal) * Add explicit call to concat::setup when creating concat file (Dominic Cleal) * Fix readme typo (Jordi Boggiano) * Update postgres_default_version for Ubuntu (Kamil Szymanski) * Allow to set connection for noew role (Kamil Szymanski) * Fix pg_hba_rule for postgres local access (Kamil Szymanski) * Fix versions for travis-ci (Ken Barber) * Add replication support (Jordi Boggiano) * Cleaned up and added unit tests (Ken Barber) * Generalization to provide more flexability in postgresql configuration (Karel Brezina) * Create dependent directory for sudoers so tests work on Centos 5 (Ken Barber) * Allow SQL commands to be run against a specific DB (Carlos Villela) * Drop trailing comma to support Puppet 2.6 (Michael Arnold) ##2.1.1 This release provides a bug fix for RHEL 5 and Centos 5 systems, or specifically systems using PostgreSQL 8.1 or older. On those systems one would have received the error: Error: Could not start Service[postgresqld]: Execution of ‘/sbin/service postgresql start’ returned 1: And the postgresql log entry: FATAL: unrecognized configuration parameter "include" This bug is due to a new feature we had added in 2.1.0, whereby the `include` directive in `postgresql.conf` was not compatible. As a work-around we have added checks in our code to make sure systems running PostgreSQL 8.1 or older do not have this directive added. #### Detailed Changes 2013-01-21 - Ken Barber * Only install `include` directive and included file on PostgreSQL >= 8.2 * Add system tests for Centos 5 ##2.1.0 This release is primarily a feature release, introducing some new helpful constructs to the module. For starters, we've added the line `include 'postgresql_conf_extras.conf'` by default so extra parameters not managed by the module can be added by other tooling or by Puppet itself. This provides a useful escape-hatch for managing settings that are not currently managed by the module today. We've added a new defined resource for managing your tablespace, so you can now create new tablespaces using the syntax: postgresql::tablespace { 'dbspace': location => '/srv/dbspace', } We've added a locale parameter to the `postgresql` class, to provide a default. Also the parameter has been added to the `postgresql::database` and `postgresql::db` defined resources for changing the locale per database: postgresql::db { 'mydatabase': user => 'myuser', password => 'mypassword', encoding => 'UTF8', locale => 'en_NG', } There is a new class for installing the necessary packages to provide the PostgreSQL JDBC client jars: class { 'postgresql::java': } And we have a brand new defined resource for managing fine-grained rule sets within your pg_hba.conf access lists: postgresql::pg_hba { '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', } Finally, we've also added Travis-CI support and unit tests to help us iterate faster with tests to reduce regression. The current URL for these tests is here: https://travis-ci.org/puppetlabs/puppet-postgresql. Instructions on how to run the unit tests available are provided in the README for the module. A big thanks to all those listed below who made this feature release possible :-). #### Detailed Changes 2013-01-18 - Simão Fontes & Flaper Fesp * Remove trailing commas from params.pp property definition for Puppet 2.6.0 compatibility 2013-01-18 - Lauren Rother * Updated README.md to conform with best practices template 2013-01-09 - Adrien Thebo * Update postgresql_default_version to 9.1 for Debian 7.0 2013-01-28 - Karel Brezina * Add support for tablespaces 2013-01-16 - Chris Price & Karel Brezina * Provide support for an 'include' config file 'postgresql_conf_extras.conf' that users can modify manually or outside of the module. 2013-01-31 - jv * Fix typo in README.pp for postgresql::db example 2013-02-03 - Ken Barber * Add unit tests and travis-ci support 2013-02-02 - Ken Barber * Add locale parameter support to the 'postgresql' class 2013-01-21 - Michael Arnold * Add a class for install the packages containing the PostgreSQL JDBC jar 2013-02-06 - fhrbek * Coding style fixes to reduce warnings in puppet-lint and Geppetto 2013-02-10 - Ken Barber * Provide new defined resource for managing pg_hba.conf 2013-02-11 - Ken Barber * Fix bug with reload of Postgresql on Redhat/Centos 2013-02-15 - Erik Dalén * Fix more style issues to reduce warnings in puppet-lint and Geppetto 2013-02-15 - Erik Dalén * Fix case whereby we were modifying a hash after creation ##2.0.1 Minor bugfix release. 2013-01-16 - Chris Price * Fix revoke command in database.pp to support postgres 8.1 (43ded42) 2013-01-15 - Jordi Boggiano * Add support for ubuntu 12.10 status (3504405) ##2.0.0 Many thanks to the following people who contributed patches to this release: * Adrien Thebo * Albert Koch * Andreas Ntaflos * Brett Porter * Chris Price * dharwood * Etienne Pelletier * Florin Broasca * Henrik * Hunter Haugen * Jari Bakken * Jordi Boggiano * Ken Barber * nzakaria * Richard Arends * Spenser Gilliland * stormcrow * William Van Hevelingen Notable features: * Add support for versions of postgres other than the system default version (which varies depending on OS distro). This includes optional support for automatically managing the package repo for the "official" postgres yum/apt repos. (Major thanks to Etienne Pelletier and Ken Barber for their tireless efforts and patience on this feature set!) For example usage see `tests/official-postgresql-repos.pp`. * Add some support for Debian Wheezy and Ubuntu Quantal * Add new `postgres_psql` type with a Ruby provider, to replace the old exec-based `psql` type. This gives us much more flexibility around executing SQL statements and controlling their logging / reports output. * Major refactor of the "spec" tests--which are actually more like acceptance tests. We now support testing against multiple OS distros via vagrant, and the framework is in place to allow us to very easily add more distros. Currently testing against Cent6 and Ubuntu 10.04. * Fixed a bug that was preventing multiple databases from being owned by the same user (9adcd182f820101f5e4891b9f2ff6278dfad495c - Etienne Pelletier ) * Add support for ACLs for finer-grained control of user/interface access (b8389d19ad78b4fb66024897097b4ed7db241930 - dharwood ) * Many other bug fixes and improvements! --- ##1.0.0 2012-09-17 - Version 0.3.0 released 2012-09-14 - Chris Price * Add a type for validating a postgres connection (ce4a049) 2012-08-25 - Jari Bakken * Remove trailing commas. (e6af5e5) 2012-08-16 - Version 0.2.0 released +[5.4.0]:https://github.com/puppetlabs/puppetlabs-apache/compare/5.3.0...5.4.0 [5.3.0]:https://github.com/puppetlabs/puppetlabs-apache/compare/5.2.1...5.3.0 diff --git a/metadata.json b/metadata.json index ad5a312..97085c8 100644 --- a/metadata.json +++ b/metadata.json @@ -1,81 +1,81 @@ { "name": "puppetlabs-postgresql", - "version": "5.3.0", + "version": "5.4.0", "author": "Inkling/Puppet Labs", "summary": "Offers support for basic management of PostgreSQL databases.", "license": "Apache-2.0", "source": "git://github.com/puppetlabs/puppetlabs-postgresql.git", "project_page": "https://github.com/puppetlabs/puppetlabs-postgresql", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.13.1 < 5.0.0" }, { "name": "puppetlabs/apt", "version_requirement": ">= 2.0.0 < 5.0.0" }, { "name": "puppetlabs/concat", "version_requirement": ">= 1.1.0 < 5.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "RedHat", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ "5", "6", "7" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "7", "8" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "14.04", "16.04" ] } ], "requirements": [ { "name": "puppet", "version_requirement": ">= 4.7.0 < 6.0.0" } ], "pdk-version": "1.4.1", "template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git", "template-ref": "1.4.1-0-g52adbbb" } diff --git a/readmes/README_ja_JP.md b/readmes/README_ja_JP.md index 7d35811..9f4710c 100644 --- a/readmes/README_ja_JP.md +++ b/readmes/README_ja_JP.md @@ -1,1927 +1,1958 @@ # 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', + db => 'test_db', + old_role => 'marmot', + new_role => '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`に設定すると、そのデータベースをテンプレートとして指定します。 デフォルト値: `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)を参照してください。 +##### `ensure` + +権限を付与するか、無効化するかを指定します。無効化する'absent'はPostgreSQLバージョン9.1.24以降でのみ機能します。 + +有効な値: 'present'、'absent'。 +* 権限を付与するには'present'を指定します。 +* 権限を無効化するには'absent'を指定します。 + +デフォルト値: 'present'。 + #### `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)を参照してください。 +##### `ensure` + +権限を付与するか、無効化するかを指定します。デフォルトでは権限を付与します。 + +有効な値: 'present'、'absent'。 +* 権限を付与するには'present'を指定します。 +* 権限を無効化するには'absent'を指定します。 + +デフォルト値: 'present'。 + ##### `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`の項を参照してください。 +##### `ensure` + +権限を付与するか、無効化するかを指定します。デフォルトでは権限を付与します。 + +有効な値: 'present'、'absent'。 +* 権限を付与するには'present'を指定します。 +* 権限を無効化するには'absent'を指定します。 + +デフォルト値: 'present'。 + ##### `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モジュールにはサンプルタスクがあり、ユーザはデータベースに対して任意のSQLを実行できます。[PEマニュアル](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`はサポートしていません。 +このモジュールは1.xと2.x両方のバージョンの'puppetlabs-apt'モジュールをサポートしていますが、'puppetlabs-apt'の2.0.0と2.0.1はサポートしていません。 + ### 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)でご覧いただけます。