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
-
0.7.0
Follow350
- 11.11.2
- 11.11.1
- 11.11.0
- 11.10.3
- 11.10.2
- 11.10.1
- 11.10.0
- 11.9.0
- 11.8.5
- 11.8.4
- 11.8.3
- 11.8.2
- 11.8.1
- 11.8.0
- 11.7.1
- 11.7.0
- 11.6.3
- 11.6.2
- 11.6.1
- 11.6.0
- 11.5.1
- 11.5.0
- 11.4.0
- 11.3.0
- 11.2.12
- 11.2.11
- 11.2.10
- 11.2.9
- 11.2.8
- 11.2.7
- 11.2.6
- 11.2.5
- 11.2.4
- 11.2.3
- 11.2.2
- 11.2.1
- 11.2.0
- 11.1.6
- 11.1.5
- 11.1.4
- 11.1.3
- 11.1.2
- 11.1.1
- 11.1.0
- 11.0.1
- 11.0.0
- 10.0.2
- 10.0.1
- 10.0.0
- 9.1.0
- 9.0.3
- 9.0.2
- 9.0.1
- 9.0.0
- 8.3.0
- 8.2.1
- 8.2.0
- 8.1.1
- 8.1.0
- 8.0.2
- 8.0.1
- 8.0.0
- 7.1.9
- 7.1.8
- 7.1.7
- 7.1.6
- 7.1.5
- 7.1.4
- 7.1.3
- 7.1.2
- 7.1.1
- 7.1.0
- 7.0.0
- 6.1.4
- 6.1.1
- 6.1.0
- 6.0.1
- 6.0.0
- 5.2.0
- 5.1.0
- 5.0.0
- 4.0.6
- 4.0.4
- 4.0.2
- 4.0.0
- 3.4.24
- 3.4.21
- 3.4.20
- 3.4.19
- 3.4.18
- 3.4.16
- 3.4.14
- 3.4.12
- 3.4.10
- 3.4.8
- 3.4.6
- 3.4.4
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.4
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.4
- 3.0.2
- 3.0.0
- 2.4.0
- 2.2.2
- 2.2.0
- 2.1.0
- 2.0.2
- 2.0.0
- 1.0.0
- 0.99.4
- 0.99.2
- 0.99.0
- 0.11.1
- 0.11.0
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.0
- 0.7.0
Installs and configures postgresql for clients or servers
cookbook 'postgresql', '= 2.2.0', :supermarket
knife supermarket install postgresql
knife supermarket download postgresql
Description
Installs and configures PostgreSQL as a client or a server.
Requirements
Platforms
- Debian, Ubuntu
- Red Hat/CentOS/Scientific (6.0+ required) - "EL6-family"
- Fedora
- SUSE
Tested on:
- Ubuntu 10.04, 11.10, 12.04
- Red Hat 6.1, Scientific 6.1, CentOS 6.3
Cookbooks
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.
Attributes
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']['contrib']['packages']
- An array of package names
that could be installed on "server" systems for useful sysadmin tools.node['postgresql']['enable_pitti_ppa']
- Whether to enable the PPA
by Martin Pitti, which contains newer versions of PostgreSQL. See
Recipes "ppa_pitti_postgresql
" below for more information.
The following attributes are generated in
recipe[postgresql::server]
.
-
node['postgresql']['password']['postgres']
- randomly generated password by theopenssl
cookbook's library.
Configuration
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_address'] = 'localhost'
Will result in the following line in the postgresql.conf
file:
listen_address = '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.
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
)
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
node['postgresql']['pg_hba']
:
{:type => 'local', :db => 'all', :user => 'postgres', :addr => nil, :method => 'ident'}
Will result in the following line in pg_hba.conf
:
local all postgres ident
Use nil
if the CIDR-ADDRESS should be empty (as above).
Recipes
default
Includes the client recipe.
client
Installs the packages defined in the
node['postgresql']['client']['packages']
attribute.
ruby
NOTE This recipe may not currently work when installing Chef with
the
"Omnibus" full stack installer on
some platforms due to an incompatibility with OpenSSL. See
COOK-1406. You can
build from source into the Chef omnibus installation to work around
this issue.
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.
server
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
) forpostgres
- sets the password for postgres
- manages the
postgresql.conf
file. - manages the
pg_hba.conf
file.
server_debian
Installs the postgresql server packages and sets up the service. You
should include the postgresql::server
recipe, which will include
this on Debian platforms.
server_redhat
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
platforms.
contrib
Installs the packages defined in the
node['postgresql']['contrib']['packages']
attribute.
This is the contrib directory of the PostgreSQL distribution, which
includes porting tools, analysis utilities, and plug-in features that
database engineers often require. Some (like pgbench) are executable.
Others (like pg_buffercache) should be installed into the database.
ppa_pitti_postgresql
Enables Martin Pitti's PPA for updated PostgreSQL packages.
Automatically included if the node['postgresql']['enable_pitti_ppa']
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").
Resources/Providers
See the database
for resources and providers that can be used for managing PostgreSQL
users and databases.
Usage
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 and expect to use it. It performs a node.save when Chef is
not running in solo
mode. 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
role/cookboook/node.
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]"]
}
License and Author
- Author:: Joshua Timberman (joshua@opscode.com)
- Author:: Lamont Granquist (lamont@opscode.com)
- Author:: Chris Roberts (chrisroberts.code@gmail.com)
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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.