Commit graph

50 commits

Author SHA1 Message Date
deVIAntCode
f9c0d91680 Add classes to install PL/Python and the postgresql-docs
See the README for usage and provided parameters.
2015-05-29 10:00:01 +01:00
David Crome
81b4778b93 (MODULES-1761) Provide defined resource for managing recovery.conf
Currently there is no resource to use for creating the recovery.conf

This resource can create a recovery.conf for replication with all
currently supported parameters
2015-03-30 10:27:55 +02:00
Colin Wood
83b4ac1661 Allow management of logdir and add logdir parameter 2015-03-12 10:40:46 -07:00
Sebastian Reitenbach
ef1681f5e5 Changes to support OpenBSD.
Added $service_reload parameter to params.pp, in order to allow
a reload of the postgresql server on OpenBSD, which apparently doesn't
have a service binary.
2015-03-06 14:11:33 -08:00
juniorsysadmin
789543fc45 Add service_manage parameter
Loosely addresses MODULES-1522
2014-12-05 10:10:17 +11:00
Hunter Haugen
532047919a Remove firewall management
The firewall management really belongs outside of the module that
manages postgresql, like in a profile.
2014-08-21 11:12:23 -07:00
Oliver Bertuch
91fec92488 Fixed deprecation warning for class param in server.pp. Changed subclasses of server to use ::_version, which will be assigned the value from globals or (deprecated) class param. 2014-08-18 11:26:06 +02:00
txaj
e2b0bdd26f Create the pg_ident_rule defined type
This allows us to declare user map as easilly as pg_hba entries.
2014-07-26 17:14:51 -05:00
Ashley Penney
58fe218e91 Remove the ensure => absent uninstall code.
This is likely to be a controversial change so I wanted to put some
explanation of our reasoning into the commit message.  This gets
kind of complex so I'll start with the problem and then the reasoning.

Problem:

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.

Reasoning:

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.

WAIT A MINUTE:

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?  When this work is finished I'm 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.
2014-07-12 12:15:42 -04:00
Ashley Penney
8db4a0cf67 Fix Ubuntu 14.04 tests for now.
This doesn't fix the root cause of the issue, such as the fact that
dpkg can't do wildcard removals, and the uninstall fails when you're
passing in a version number like this, but THIS test doesn't care, it
just wants to make sure the deprecation warning appears in the first
place.

This does however make the tests pass on 14.04.
2014-06-03 13:21:45 -04:00
Ashley Penney
5e33409342 Add service_ensure.
This allows you to control the status of the Postgresql service directly
from postgresql::server.
2014-05-08 16:43:22 -04:00
Hunter Haugen
21001d5b0c (MODULES-630) Deprecate postgresql::server::version
Adjusting the version is explicitly done though the postgresql::globals
class, as this affects many parts of the module. This parameter did not
function correctly on systems that did not have a default, as described
in the ticket.
2014-05-07 15:25:18 -07:00
Brian Almeida
86f2950248 Add support for port parameter to postgresql::server, fix underlying assumptions that port=5432 2014-04-17 15:09:07 -04:00
Justin Stoller
c246bbbc8d remove trailing whitespace 2014-02-14 12:32:57 -08:00
Ashley Penney
8d7bf05796 Merge pull request #325 from aadamovich/patch-2
$postgresql::server::client_package_name is referred from install.pp, bu...
2014-01-21 14:36:11 -08:00
Marco Nenciarini
2b81d5cb63 Add support to custom xlogdir parameter
Having a custom xlogdir location is desiderable for performances in many production environments
2013-12-14 23:55:24 +01:00
aadamovich
02c0184f58 $postgresql::server::client_package_name is referred from install.pp, but is not defined in server.pp 2013-12-04 21:12:40 +01:00
Reid Vandewiele
cdf5b077fe Add globals/params layering for default_database
This makes the variable consistent with the manner in which most/all of
the rest of the postgresql module currently works.

Commit also adds the new param to the README file.
2013-10-26 17:56:48 -07:00
Reid Vandewiele
6afb4a0367 Allow specification of default database name
E.g. pe-postgresql does NOT use postgres as the default database name.
It uses pe-postgres. So if there is no way to specify a default database
name, the postgesql::validate_db_connection resource in
postgresql::server::service will ALWAYS fail. This commit exposes the
parameter in order to avoid that situation.
2013-10-26 16:33:36 -07:00
cdenneen
81dbea2ec5 fixed typo 2013-10-23 13:45:44 -04:00
cdenneen
ab5c177b76 Update server.pp
add require of install to reload class
2013-10-23 12:58:25 -04:00
Mickaël Canévet
6f614b0b37 Add a parameter to (un)manage pg_hba.conf 2013-10-16 14:58:08 +02:00
Ken Barber
809003d0f9 serverspec + some cleanup
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-19 16:30:15 +01:00
Ken Barber
c8d3ecde14 Various cleanups
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-18 22:25:51 +01:00
Ken Barber
7d84b6ac0e Add datadir back, as its used within a lot of tests
Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:17 +01:00
Ken Barber
59c1cbfbf8 Major rewrite to solve order dependencies and unclear public API
This is a very very large change to the module. It started out as a fix to add
postgresl::server::config_entry, and quickly became a rewrite to fix a lot of
ordering issues inherent in the API.

Since this changes the Public API it is considered a backwards compatible
change.

See the upgrading guide in README.md for more details as to what has been
modified in this patch.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:15 +01:00
Rahul Gopinath
20bdf10b72 Adding anchors around contained resources 2013-09-14 06:38:53 +01:00
Ashley Penney
f7116f5aad Style guide cleanup.
Most of these changes are just simple bits but I've wrapped a bunch of
stuff around 80 lines so it's slightly more readable.  These should all
be no-op changes.
2013-08-26 12:22:13 -04:00
Ken Barber
80c85e8f2b Convert system tests to use rspec-system
This patch ports all of the existing system tests to use rspec-system instead.

To assist with this conversion some patches were made to fix OS compatibility
where necessary. We also added an ensure parameter to the postgresql::server
class to assist with removing PostgreSQL configuration to aid with testing
cleanups.

The documentation has been updated to indicate test usage with rspec-system,
we've also renamed the 'tests' directory to 'examples'.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-06-04 15:36:24 +01:00
Dominic Cleal
4b5212f803 Enable hasstatus for EL and Puppet 2.6, to detect running server 2013-03-21 18:13:17 +00:00
Erik Dalén
6322aff0e8 don't modify variables 2013-02-15 17:19:31 +00:00
Erik Dalén
23368ffb03 fix lots of style issues 2013-02-15 17:22:52 +01:00
Ken Barber
b9db279c04 Do not run the reload of postgresql as postgresql
While this worked fine in Ubuntu, it failed silently in Centos.

The script is really designed to be ran as root, so removing the user
property. This was failing our new pg_hba_rule tests without it.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-12 00:34:44 +00:00
Karel Brezina
236ce4783a Added info about the advanced configuration file 2013-02-01 12:46:59 +01:00
Chris Price
228e5c5337 Cleanup and move control of version into params
Thanks to some tricks I learned from Nan Liu and Dan Bode, I was
able to figure out a way to move all of the new version-related stuff
back into the params class, and clean up some of the if/_real stuff.

Basic tests for centos6 + pg 9.2 are passing.
2012-12-04 14:12:41 -08:00
Chris Price
18167c7a3e Merge platform.pp back into params.pp
Nan showed me a trick that will let us keep all of that param stuff
inside of params.pp, make it a parameterized class, and still support
the ability for users to specify a custom (non-system-default) pg
version.  This commit takes the first step towards that pattern by
consolidating platform.pp and params.pp.  (Everything old is new again!)
2012-12-04 14:12:34 -08:00
Chris Price
fa24f24397 Re-add support for managing yumrepo
This commit creates a new class called `package_source_info`,
which has some initial framework for managing the postgresql.org
yumrepo.  It also serves as a container for the 'version'
variable that is needed by the 'platform' class in order to
use other versions of postgres besides the system default.
2012-12-02 23:06:36 -08:00
Chris Price
663c779309 A few minor fixes to get tests passing again 2012-12-02 22:05:57 -08:00
Chris Price
de45945aff Merge ::paths and ::packages into one class, called ::platform. 2012-12-02 20:59:18 -08:00
Chris Price
90ed7aaf6d Working on getting ubuntu specs passing again
The service provider / status stuff got a little broken during
the refactors.  This should mostly fix it but there is still
one spec failing, and I will probably also refactor the
paths.pp and packages.pp into a single file together eventually.
2012-12-02 20:56:36 -08:00
Etienne Pelletier
33add5e10a Removed postgresql::version class and moved version info to init.pp. 2012-12-02 20:56:29 -08:00
Etienne Pelletier
ca701b303c Removed repo class. 2012-12-02 20:54:39 -08:00
Etienne Pelletier
1fe9559bbe Refactored multi-version support. 2012-12-02 20:54:33 -08:00
Etienne Pelletier
a5d3de2dc4 Pulled repository stuff out of params.
Lint cleanup.
2012-12-02 20:49:47 -08:00
Andreas Ntaflos
d44de361b6 Set sensible path in exec to reload postgres
In the exec resource to reload postgres add path parameter and set it to
"/usr/bin:/usr/sbin:/bin:/sbin", so that the service command can be
called correctly on different platforms.
2012-11-15 16:39:56 +01:00
Andreas Ntaflos
19a512b06d Add new exec 'reload_postgresql' and have the pg_hba.conf file resource
notify that exec after changes to pg_hba.conf. This avoids restarting
the whole postgresql cluster for configuration changes in pg_hba.conf
which only need a reload.
2012-11-09 23:46:16 +01:00
William Van Hevelingen
bdf6c0b84c Puppet lint fixes
- left longer than 80 char warnings
 - left inherits params class warnings
2012-11-03 02:37:20 +00:00
Matthaus Owens
82c5863431 Update status for postgres service on Debian
The postgresql init script on debian/ubuntu returns 0 no matter whether postgresql is started or stopped, so puppet has no way of knowing whether to start postgresql when the service is set to 'ensure => running'. This commit adds a param to the params class called $service_status which is set to the status piped to an egrep on debian/ubuntu, which reliably returns 0 if there are clusters running and 1 if there are none. The output before and after this patch can be seen below. If the init script is fixed at some point, the logic would need to be revisited.

Before patch postgresql remains stopped after puppet run.

$ # service postgresql stop
$ #   * Stopping PostgreSQL 9.1 database server
$ # puppet apply -e "class {'postgresql::server':}"
$ #   notice: Finished catalog run in 0.15 seconds
$ # service postgresql status
$ #   Running clusters:

After patch postgresql is started after puppet run.

$ # service postgresql stop
$ #   * Stopping PostgreSQL 9.1 database server
$ # puppet apply -e "class {'postgresql::server':}"
$ #   notice: /Stage[main]/Postgresql::Server/Service[postgresqld]/ensure: ensure changed 'stopped' to 'running'
$ #   notice: Finished catalog run in 2.26 seconds
$ # service postgresql status
$ #   Running clusters: 9.1/main
2012-09-28 15:53:33 -07:00
Chris Price
ba802475ff Improve configuration for initial postgres install
This commit adds some configuration management for
postgres, to allow users to get a more complete
setup from their initial install.  Prior to this
commit, we were basically only ensuring that the
package was installed and the service was running.

Now, we support limited configuration for the
pg_hba.conf file to enable md5 authentication for
remote hosts, and for the postgresql.conf file
to specify the listener addresses where TCP
connections should be accepted.  Without these
two changes the initial postgres configuration
doesn't allow *any* connections from outside of the
local host.

This commit also adds an option for opening up the
postgres port in the firewall on redhat-based systems,
and an option to allow setting the password for the
'postgres' database user.

As of this commit, this module now has dependencies
on puppetlabs-stdlib (version > 2.3.4, which includes
the new 'match' parameter for the 'file_line' resource
type), and on puppetlabs-firewall.
2012-06-08 14:00:24 -07:00
Chris Price
6034e122de Working version of postgresql::server
This is a first working version of postgresql::server.
It includes a very simple test manifest, which has
been tried out on CentOS6 and Ubuntu 10.04; initial
tests were successful both from a clean state and
for subsequent runs.

Includes a new fact called 'postgres_default_version',
which detects what the default version of postgres is
for a given OS.  This is needed because some of the
commands and directory names include this version string.

Current implementation *only* supports managing the
system default version; in the future it would be nice
to allow the user to explicitly specify a postgres version,
but that isn't yet supported.

The "postgresql::server" class includes a call to postgres's
initdb command on redhat systems, because they don't do
this automatically when the package is installed.
2012-06-08 13:37:21 -07:00