Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


postgresql (112) Versions 4.0.6

Installs and configures postgresql for clients or servers

cookbook 'postgresql', '= 4.0.6', :supermarket
cookbook 'postgresql', '= 4.0.6'
knife supermarket install postgresql
knife supermarket download postgresql
Quality 50%


Installs and configures PostgreSQL as a client or a server.



  • Debian, Ubuntu
  • Red Hat/CentOS/Scientific (6.0+ required) - "EL6-family"
  • Fedora
  • SUSE

Tested on:

  • Ubuntu 12.04, 14.04, 14.10
  • Red Hat 6.1, Scientific 6.1, CentOS 6.3, 7.0, OpenSuse


Requires Opscode's openssl cookbook for secure password generation.

Requires a C compiler and development headers in order to build the
pg RubyGem to provide Ruby bindings in the ruby recipe.

Opscode's build-essential cookbook provides this functionality on
Debian, Ubuntu, and EL6-family.

While not required, Opscode's database cookbook contains resources
and providers that can interact with a PostgreSQL database. This
cookbook is a dependency of database.


The following attributes are set based on the platform, see the
attributes/default.rb file for default values.

  • node['postgresql']['version'] - version of postgresql to manage
  • node['postgresql']['dir'] - home directory of where postgresql
    data and configuration lives.

  • node['postgresql']['client']['packages'] - An array of package names
    that should be installed on "client" systems.

  • node['postgresql']['server']['packages'] - An array of package names
    that should be installed on "server" systems.

  • node['postgresql']['server']['config_change_notify'] - Type of
    notification triggered when a config file changes.

  • node['postgresql']['contrib']['packages'] - An array of package names
    that could be installed on "server" systems for useful sysadmin tools.

  • node['postgresql']['enable_pgdg_apt'] - Whether to enable the apt repo
    by the PostgreSQL Global Development Group, which contains newer versions
    of PostgreSQL.

  • node['postgresql']['enable_pgdg_yum'] - Whether to enable the yum repo
    by the PostgreSQL Global Development Group, which contains newer versions
    of PostgreSQL.

  • node['postgresql']['initdb_locale'] - Sets the default locale for the
    database cluster. If this attribute is not specified, the locale is
    inherited from the environment that initdb runs in. Sometimes you must
    have a system locale that is not what you want for your database cluster,
    and this attribute addresses that scenario. Valid only for EL-family
    distros (RedHat/Centos/etc.).

The following attributes are generated in


The postgresql.conf and pg_hba.conf files are dynamically
generated from attributes. Each key in node['postgresql']['config']
is a postgresql configuration directive, and will be rendered in the
config file. For example, the attribute:

node['postgresql']['config']['listen_addresses'] = 'localhost'

Will result in the following line in the postgresql.conf file:

listen_addresses = 'localhost'

The attributes file contains default values for Debian and RHEL
platform families (per the node['platform_family']). These defaults
have disparity between the platforms because they were originally
extracted from the postgresql.conf files in the previous version of
this cookbook, which differed in their default config. The resulting
configuration files will be the same as before, but the content will
be dynamically rendered from the attributes. The helpful commentary
will no longer be present. You should consult the PostgreSQL
documentation for specific configuration details.

See Recipes config_initdb and config_pgtune below to
auto-generate many postgresql.conf settings.

For values that are "on" or "off", they should be specified as literal
true or false. String values will be used with single quotes. Any
configuration option set to the literal nil will be skipped
entirely. All other values (e.g., numeric literals) will be used as
is. So for example:

node.default['postgresql']['config']['logging_collector'] = true
node.default['postgresql']['config']['datestyle'] = 'iso, mdy'
node.default['postgresql']['config']['ident_file'] = nil
node.default['postgresql']['config']['port'] = 5432

Will result in the following config lines:

logging_collector = 'on'
datestyle = 'iso,mdy'
port = 5432

(no line printed for ident_file as it is nil)

Note that the unix_socket_directory configuration was renamed to
unix_socket_directories in Postgres 9.3 so make sure to use the
node['postgresql']['unix_socket_directories'] attribute instead of

The pg_hba.conf file is dynamically generated from the
node['postgresql']['pg_hba'] attribute. This attribute must be an
array of hashes, each hash containing the authorization data. As it is
an array, you can append to it in your own recipes. The hash keys in
the array must be symbols. Each hash will be written as a line in
pg_hba.conf. For example, this entry from

[{:comment => '# Optional comment',
:type => 'local', :db => 'all', :user => 'postgres', :addr => nil, :method => 'md5'}]

Will result in the following line in pg_hba.conf:

# Optional comment
local   all             postgres                                md5

Use nil if the CIDR-ADDRESS should be empty (as above).
Don't provide a comment if none is desired in the pg_hba.conf file.

Note that the following authorization rule is supplied automatically by
the cookbook template. The cookbook needs this to execute SQL in the
PostgreSQL server without supplying the clear-text password (which isn't
known by the cookbook). Therefore, your node['postgresql']['pg_hba']
attributes don't need to specify this authorization rule:

# "local" is for Unix domain socket connections only
local   all             all                                     ident

(By the way, the template uses peer instead of ident for PostgreSQL-9.1
and above, which has the same effect.)



Includes the client recipe.


Installs the packages defined in the
node['postgresql']['client']['packages'] attribute.


Install the pg gem under Chef's Ruby environment so it can be used
in other recipes. The build-essential packages and postgresql client
packages will be installed during the compile phase, so that the
native extensions of pg can be compiled.


Includes the server_debian or server_redhat recipe to get the
appropriate server packages installed and service managed. Also
manages the configuration for the server:

  • generates a strong default password (via openssl) for postgres
  • sets the password for postgres
  • manages the postgresql.conf file.
  • manages the pg_hba.conf file.


Installs the postgresql server packages and sets up the service. You
should include the postgresql::server recipe, which will include
this on Debian platforms.


Manages the postgres user and group (with UID/GID 26, per RHEL package
conventions), installs the postgresql server packages, initializes the
database, and manages the postgresql service. You should include the
postgresql::server recipe, which will include this on RHEL/Fedora


Takes locale and timezone settings from the system configuration.
This recipe creates node.default['postgresql']['config'] attributes
that conform to the system's locale and timezone. In addition, this
recipe creates the same error reporting and logging settings that
initdb provided: a rotation of 7 days of log files named
postgresql-Mon.log, etc.

The default attributes created by this recipe are easy to override with
normal attributes because of Chef attribute precedence. For example,
suppose a DBA wanted to keep log files indefinitely, rolling over daily
or when growing to 10MB. The Chef installation could include the
postgresql::config_initdb recipe for the locale and timezone settings,
but customize the logging settings with these node JSON attributes:

"postgresql": {
  "config": {
    "log_rotation_age": "1d",
    "log_rotation_size": "10MB",
    "log_filename": "postgresql-%Y-%m-%d_%H%M%S.log"

Credits: This postgresql::config_initdb recipe is based on algorithms
in the source code
for the PostgreSQL initdb utility.


Performance tuning.
Takes the wimpy default postgresql.conf and expands the database server
to be as powerful as the hardware it's being deployed on. This recipe
creates a baseline configuration of node.default['postgresql']['config']
attributes in the right general range for a dedicated Postgresql system.
Most installations won't need additional performance tuning.

The only decision you need to make is to choose a db_type from the
following database workloads. (See the recipe code comments for more
detailed descriptions.)

  • "dw" -- Data Warehouse
  • "oltp" -- Online Transaction Processing
  • "web" -- Web Application
  • "mixed" -- Mixed DW and OLTP characteristics
  • "desktop" -- Not a dedicated database

This recipe uses a performance model with three input parameters.
These node attributes are completely optional, but it is obviously
important to choose the db_type correctly:

  • node['postgresql']['config_pgtune']['db_type'] --
    Specifies database type from the list of five choices above.
    If not specified, the default is "mixed".

  • node['postgresql']['config_pgtune']['max_connections'] --
    Specifies maximum number of connections expected.
    If not specified, it depends on database type:
    "web":200, "oltp":300, "dw":20, "mixed":80, "desktop":5

  • node['postgresql']['config_pgtune']['total_memory'] --
    Specifies total system memory in kB. (E.g., "49416564kB".)
    If not specified, it will be taken from Ohai automatic attributes.
    This could be used to tune a system that isn't a dedicated database.

The default attributes created by this recipe are easy to override with
normal attributes because of Chef attribute precedence. For example, if
you are running application benchmarks to try different buffer cache
sizes, you would experiment with this node JSON attribute:

"postgresql": {
  "config": {
    "shared_buffers": "3GB"

Note that the recipe uses max_connections in its computations. If
you want to override that setting, you should specify
node['postgresql']['config_pgtune']['max_connections'] instead of

Credits: This postgresql::config_pgtune recipe is based on the
pgtune python script
developed by
Greg Smith
other pgsql-hackers.


Installs the packages defined in the
node['postgresql']['contrib']['packages'] attribute. The contrib
directory of the PostgreSQL distribution includes porting tools,
analysis utilities, and plug-in features that database engineers often
require. Some (like pgbench) are executable. Others (like
pg_buffercache) would need to be installed into the database.

Also installs any contrib module extensions defined in the
node['postgresql']['contrib']['extensions'] attribute. These will be
available in any subsequently created databases in the cluster, because
they will be installed into the template1 database using the
CREATE EXTENSION command. For example, it is often necessary/helpful
for problem troubleshooting and maintenance planning to install the
views and functions in these standard instrumentation extensions:

node['postgresql']['contrib']['extensions'] = [

Note that the pg_stat_statements view only works if postgresql.conf
loads its shared library, which can be done with this node attribute:

node['postgresql']['config']['shared_preload_libraries'] = 'pg_stat_statements'

If using shared_preload_libraries in combination with the contrib recipe,
make sure that the contrib recipe is called before the server recipe (to
ensure the dependencies are installed and setup in order).


Enables the PostgreSQL Global Development Group yum repository
maintained by Devrim Gündüz for updated PostgreSQL packages.
(The PGDG is the groups that develops PostgreSQL.)
Automatically included if the node['postgresql']['enable_pgdg_apt']
attribute is true. Also set the
node['postgresql']['client']['packages'] and
node['postgresql']['server]['packages'] to the list of packages to
use from this repository, and set the node['postgresql']['version']
attribute to the version to use (e.g., "9.2").


Enables the PostgreSQL Global Development Group yum repository
maintained by Devrim Gündüz for updated PostgreSQL packages.
(The PGDG is the groups that develops PostgreSQL.)
Automatically included if the node['postgresql']['enable_pgdg_yum']
attribute is true. Also use override_attributes to set a number of
values that will need to have embedded version numbers. For example:

node['postgresql']['enable_pgdg_yum'] = true
node['postgresql']['version'] = "9.4"
node['postgresql']['dir'] = "/var/lib/pgsql/9.4/data"
node['postgresql']['config']['data_directory'] = node['postgresql']['dir']
node['postgresql']['client']['packages'] = ["postgresql94", "postgresql94-devel"]
node['postgresql']['server']['packages'] = ["postgresql94-server"]
node['postgresql']['server']['service_name'] = "postgresql-9.4"
node['postgresql']['contrib']['packages'] = ["postgresql94-contrib"]
node['postgresql']['setup_script'] = "postgresql94-setup"

You may set node['postgresql']['pgdg']['repo_rpm_url'] attributes
to pick up recent PGDG repo packages.


See the database
for resources and providers that can be used for managing PostgreSQL
users and databases.


On systems that need to connect to a PostgreSQL database, add to a run
list recipe[postgresql] or recipe[postgresql::client].

On systems that should be PostgreSQL servers, use
recipe[postgresql::server] on a run list. This recipe does set a
password for the postgres user.
If you're using chef server, if the attribute
node['postgresql']['password']['postgres'] is not found,
the recipe generates a random password and performs a
(TODO: This is broken, as it disables the password.)
If you're using chef-solo, you'll need
to set the attribute node['postgresql']['password']['postgres'] in
your node's json_attribs file or in a role.

On Debian family systems, SSL will be enabled, as the packages on
Debian/Ubuntu also generate the SSL certificates. If you use another
platform and wish to use SSL in postgresql, then generate your SSL
certificates and distribute them in your own cookbook, and set the
node['postgresql']['config']['ssl'] attribute to true in your

On server systems, the postgres server is restarted when a configuration
file changes. This can be changed to reload only by setting the
following attribute:

node['postgresql']['server']['config_change_notify'] = :reload

Chef Solo Note

The following node attribute is stored on the Chef Server when using
chef-client. Because chef-solo does not connect to a server or
save the node object at all, to have the password persist across
chef-solo runs, you must specify them in the json_attribs file
used. For Example:

  "postgresql": {
    "password": {
      "postgres": "iloverandompasswordsbutthiswilldo"
  "run_list": ["recipe[postgresql::server]"]

That should actually be the "encrypted password" instead of cleartext,
so you should generate it as an md5 hash using the PostgreSQL algorithm.

  • You could copy the md5-hashed password from an existing postgres database if you have postgres access and want to use the same password:<br> select * from pg_shadow where usename='postgres';
  • You can run this from any postgres database session to use a new password:<br> select 'md5'||md5('iloverandompasswordsbutthiswilldo'||'postgres');
  • You can run this from a linux commandline:<br> echo -n 'iloverandompasswordsbutthiswilldo''postgres' | openssl md5 | sed -e 's/.* /md5/'

License and Author

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

apt >= 1.9.0
build-essential >= 0.0.0
openssl ~> 4.0

Contingent cookbooks

akibanserver Applicable Versions
alfresco Applicable Versions
askbot Applicable Versions
bacula-server Applicable Versions
bamboo Applicable Versions
chef-bareos Applicable Versions
chef-manageiq Applicable Versions
chef_crowd Applicable Versions
chef_jira Applicable Versions
cloudfoundry-cloud_controller Applicable Versions
cloudless-box Applicable Versions
confluence Applicable Versions
crowd Applicable Versions
database Applicable Versions
database_application Applicable Versions
databox Applicable Versions
django_platform Applicable Versions
dvwa Applicable Versions
etherpad-lite Applicable Versions
eulipion-cleanspeak Applicable Versions
fanfare Applicable Versions
flyway-cli Applicable Versions
foreman Applicable Versions
github_connector Applicable Versions
gitlab Applicable Versions
gitlabhq Applicable Versions
gitrob Applicable Versions
gotcms Applicable Versions
ignite-openfire Applicable Versions
jenkins_build Applicable Versions
jira Applicable Versions
lemur Applicable Versions
liquid-feedback Applicable Versions
mediacore Applicable Versions
metarepo Applicable Versions
mirage Applicable Versions
multicorn Applicable Versions
mx Applicable Versions
noosfero Applicable Versions
oc-id Applicable Versions
openerp Applicable Versions
openfire Applicable Versions
opennms Applicable Versions
openresty Applicable Versions
openstack-mistral Applicable Versions
openstack-ops-database Applicable Versions
owncloud Applicable Versions
paramount Applicable Versions
pentester Applicable Versions
pg-multi Applicable Versions
pg_monz Applicable Versions
pg_repack Applicable Versions
postfixadmin Applicable Versions
postgis Applicable Versions
postgres-hardening Applicable Versions
postgresql-cluster Applicable Versions
pvpgn Applicable Versions
rackmonkey Applicable Versions
railsbox Applicable Versions
razor Applicable Versions
redmine2 Applicable Versions
repmgr Applicable Versions
rubycas Applicable Versions
sphinx Applicable Versions
stackstorm Applicable Versions
stash Applicable Versions
supermarket Applicable Versions
webapp Applicable Versions
zabbix Applicable Versions
zabbix-pkg Applicable Versions
zabbix_lwrp Applicable Versions

postgresql Cookbook CHANGELOG

This file is used to list changes made in each version of the postgresql cookbook.


  • Add 16.04 Xenial to the allowed list


  • Add leading pound symbol on pg_hba.conf template comment line
  • Update gem install for compile_time to correct deprication warning
  • Add support Ubuntu Wily Werewolf pgdg apt repository
  • test-kitchen platforms for Centos 7.2 and Ubuntu 15.04
  • Fixes PostgreSQL version & package name defaults for EL7 distros
  • Add appropriate systemd unit file overrides for EL7 distros


  • Add Code of Conduct
  • Add Rubocop
  • Clean up of syntax in many places as result of adding and evaluating Rubocop
  • Updates to test-kitchen.yml
  • added additional attribute for people who are importing pgdg packages for internal repositories
    • default['postgresql']['use_pgdg_packages'] = false


WARNING: Please read carefully through the stated changes, as they probably will break your current setup and can result in duplicate postgresql versions being installed, configuration corruption and data loss! This list might not be complete, so be careful when using the 4.x version and make sure to test it extensively before production use!

When in doubt, put the following in your Berksfile until you are ready to upgrade:

cookbook 'postgresql', '=~ 3.4.0'
  • Potential breaking change: Restructured default attributes to avoid compile time deriving other attribute values from value of the node[‘postgresql’][‘version’] (#313, #302, #295, #288, #280, #261, #260, #254, #248, #217, #214, #167, #143). If you specify a custom postgresql version, make sure to adapt the following attributes as well:
default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
default['postgresql']['client']['packages'] = [ "postgresql-client-#{node['postgresql']['version']}", 'libpq-dev' ]
default['postgresql']['server']['packages'] = [ "postgresql-#{node['postgresql']['version']}" ]
default['postgresql']['contrib']['packages'] = [ "postgresql-contrib-#{node['postgresql']['version']}" ]
  • Potential breaking change: SSL configuration parameters. Due to the new structuring, make sure you set all SSL attributes to override when specifying them in a cookbook:
override['postgresql']['config']['ssl'] = true
override['postgresql']['config']['ssl_cert_file'] = "/path/to/cert.crt"
override['postgresql']['config']['ssl_key_file']  = "/path/to/cert.key"
override['postgresql']['config']['ssl_ciphers']  = "<my cipher suite>"
  • Potential breaking change: Some node attributes are now persistet in your node configuration. This affects the following attributes:
"config": {
  "data_directory": "/var/lib/postgresql/9.4/main",
  "hba_file": "/etc/postgresql/9.4/main/pg_hba.conf",
  "ident_file": "/etc/postgresql/9.4/main/pg_ident.conf",
  "external_pid_file": "/var/run/postgresql/",
  "unix_socket_directories": "/var/run/postgresql",
  "ssl_cert_file": "/etc/ssl/certs/ssl-cert-snakeoil.pem",
  "ssl_key_file": "/etc/ssl/private/ssl-cert-snakeoil.key"
  • Potential breaking change: Parsing of attributes from node/ environment configuration. It has been reported that setting the node['postgresql']['client']['packages'] attribute in a cookbook might result in the default version of the postgresql client package being installed alongside the required version. This might affect the server packages as well.
  • Correct issues which caused the inability to override installation version defaults
  • Correct issues which caused configuration file entries with miss matching version numbers and incorrect file system paths being defined
  • Remove method pgdgrepo_rpm_info compile time use of derived attributes case many issues
  • Use correct directory path and check for the correct not_if condition to determine if the database has been initialized
  • Ensure that correct packages are installed in all scenarios where pg gem is compiled
  • Fix errors in configuration files for unix_socket_directory and unix_socket_directories
  • Updates to test-kitchen suite configuration
  • Added more grey hair to my beard


  • Corrections to address repositories signed with newer certificates that some distributions have in their default ca-certificates package
  • Updates to more accurately determine distributions service init systems adds better support for systemd systems
  • Correct how version attribute is evaluated in certain places
  • test-kitchen suite configuration corrections
  • Opensuse support


  • Skipping 3.4.22 with Develop branch 3.4.23 to return to releasing cookbook from master on even numbers and develop on odd numbers.


  • Use more optimistic openssl version constraint
  • Add Postgresql 9.4 package sources for RHEL platforms
  • Update testing infrastructure to address bit rot


  • Revert #251, a change which caused the postgresql service to restart every Chef run.


  • could better not be run on every chef run since it causes node.default attributes stored to the node objects to differ during a chef run and when
  • Missing attribute in docs for yum_pgdg_postgresql
  • restart postgres service immediately on config change
  • Run restart command right away on the postgresql service.
  • Add kitchen test for shared_preload_libraries & extension setup.
  • Fix install order of contrib packages to fix pg_stat_statements issues.
  • Add Debian Jessie to whitelist for repo
  • Install version 9.4 on Debian Jessie
  • add amazon 2015
  • add rhel7 support


  • Revert changes from #201 with the intention of revisiting these changes as part of the next major version release.
  • Specify version constraint on openssl cookbook due to an upstream release mishap


  • Changed hard coded value to attribute #219
  • Correction for directory creation under debian, etc. #222
  • Fedora 20 yum support #223
  • Define version-sensitive attributes in a recipe #201


  • Support apt repository for Ubuntu Utopic 14.10
  • Do not try and set password on standby hosts


  • Create configuration templates at the appropriate time
  • If template is updated restart service changed to default of :delayed
  • Fix SSL for PostgreSQL versions < 9.2


  • correct conditional error created in 3.4.8.


  • Correct scenario where work_mem could be set to 0 if con is greater than mem Issue #185
  • Add Centos7 suites to kitchen configuration


  • Don't include the pgdg recipes on the wrong machine types
  • Add missing dir /etc/sysconfig/pgsl for centos7
  • CentOS 7 package support


  • fix packages on SLES11SP2 and higher
  • [COOK-4737] Add flag to control database user password behavior
  • add amazon platform rpm info
  • Fix issues with the server_redhat recipe on Fedora 16 and later
  • attribute typo correction
  • correctly check and set max_connections to an integer


  • Changed the Gem::Installer::ExtensionBuildError to a Mixlib::ShellOut::ShellCommandFailed



Updated CONTRIBUTING document.
Refreshed test kitchen configuration.
Merged Pull Requests: 122, 116, 104, 102, 99, 96, 93, 90.




  • Testing maintainer transfer to Heavywater with Opscode as collaborator



  • COOK-3851 - Postgresql: reload after config change does not pick up certain configuration changes
  • COOK-3611 - unix_socket_directory does not exists in 9.3
  • COOK-2954 - PostgreSQL installation ignores version attribute on CentOS >= 6


  • [COOK-3717] Pgdg repositories improvements
  • [COOK-3756] Change postgresql.conf mode from 0600 to 0644



  • COOK-3685 - Upgrade Repo Attributes for Postgresql 9.3
  • COOK-3597 - Fix implementation of initdb_locale attribute for RHEL
  • COOK-3566 - Give the user's rules more priority than the default ones in pg_hba
  • COOK-3553 - Remove automatic apt-get update


  • COOK-3611 - Remove unix_socket_directory (it does not exists in 9.3)
  • COOK-3599 - Automatically add PGDG apt repo dependency on PostgreSQL version
  • COOK-3555 - Documentation Fix
  • COOK-2383 - Update Postgres version in attributes



  • COOK-3173 - Use :reload instead of :restart on conf changes
  • COOK-2939 - Fix RedHat support



  • [COOK-3076]: postgresql::ruby recipe error when using pgdg repositories


This is a backwards-incompatible release because the Pitti PPA is deprecated and the recipe removed, replaced with the PGDG apt repository.


  • [COOK-2571]: Create helper library for pg extension detection
  • [COOK-2797]: Contrib extension contianing '-' fails to load.


  • [COOK-2387]: Pitti Postgresql PPA is deprecated


  • [COOK-3022]: update baseboxes in .kitchen.yml


  • [COOK-2163] - Dangerous "assign-postgres-password" in "recipes/server.rb" -- Can lock out dbadmin access
  • [COOK-2390] - Recipes to auto-generate many postgresql.conf settings, following "initdb" and "pgtune"
  • [COOK-2435] - Foodcritic fixes for postgresql cookbook
  • [COOK-2476] - Installation into database of any contrib module extensions listed in a node attribute


  • [COOK-2232] -Provide PGDG yum repo to install postgresql 9.x on redhat-derived distributions


  • [COOK-2230] - Careful about Debian minor version numbers
  • [COOK-2231] - Fix support for postgresql 9.x in server_redhat recipe
  • [COOK-2238] - Postgresql recipe error in password check
  • [COOK-2176] - PostgreSQL cookbook in Solo mode can cause "NoMethodError: undefined method `[]' for nil:NilClass"
  • [COOK-2233] - Provide postgresql::contrib recipe to install useful server administration tools


  • [COOK-1872] - Allow latest PostgreSQL deb packages to be installed
  • [COOK-1961] - Postgresql config file changes with every Chef run
  • [COOK-2041] - Postgres cookbook no longer installs on OpenSuSE 11.4


  • [COOK-1406] - pg gem compile is unable to find libpq under Chef full stack (omnibus) installation


This version is backwards incompatible with previous versions of the cookbook due to use of platform_family, and the refactored configuration files using node attributes. See for details on how to modify configuration of PostgreSQL.

  • [COOK-1508] - fix mixlib shellout error on SUSE
  • [COOK-1744] - Add service enable & start
  • [COOK-1779] - Don't run apt-get update and others in ruby recipe if pg is installed
  • [COOK-1871] - Attribute driven configuration files for PostgreSQL
  • [COOK-1900] - don't assume ssl on all postgresql 8.4+ installs
  • [COOK-1901] - fail a chef-solo run when the postgres password attribute is not set


Important note for this release

This version no longer installs Ruby bindings in the client recipe by default. Use the ruby recipe if you'd like the RubyGem. If you'd like packages for your distribution, use them in your application's specific cookbook/recipe, or modify the client packages attribute.

This resolves the following tickets.

  • COOK-1011
  • COOK-1534

The following issues are also resolved with this release.

  • [COOK-1011] - Don't install postgresql packages during compile phase and remove pg gem installation
  • [COOK-1224] - fix undefined variable on Debian
  • [COOK-1462] - Add attribute for specifying listen address


  • [COOK-421] - config template is malformed
  • [COOK-956] - add make package on ubuntu/debian


  • [COOK-916] - use < (with float) for version comparison.


  • Better support for Red Hat-family platforms
  • Integration with database cookbook
  • Make sure the postgres role is updated with a (secure) password

Collaborator Number Metric

4.0.6 passed this metric

Foodcritic Metric

4.0.6 failed this metric

FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/ruby.rb:46
FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/ruby.rb:47
FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:26
FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:27
FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:32
FC001: Use strings in preference to symbols to access node attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:34
FC002: Avoid string interpolation where not required: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:32
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/ruby.rb:46
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/ruby.rb:47
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:26
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:27
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:32
FC019: Access node attributes in a consistent manner: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/yum_pgdg_postgresql.rb:34
FC023: Prefer conditional attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/server.rb:69
FC023: Prefer conditional attributes: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/server.rb:75
FC037: Invalid notification action: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/server_conf.rb:42
FC037: Invalid notification action: /tmp/a73b162f1689ec2e58f2b3dc/postgresql/recipes/server_conf.rb:50