fuel-library/deployment/puppet/postgresql/README.md
2012-10-22 16:41:23 +04:00

2.0 KiB

Puppet module for PostgreSQL resources

This module provides the following defined resource types for managing postgres:

  • postgresql::initdb
  • postgresql::db
  • postgresql::role
  • postgresql::user (just for clarity; users are roles in postgres)
  • postgresql::grant

And the fallback, analogous to exec resources, only for SQL statements:

  • postgresql::psql

Basic usage

postgresql::user{'marmot':
    password => 'foo',
}

postgresql::grant{'grant select to marmot':
   grantee   => 'marmot',
   on_object => 'my_table',
   perm      => 'select',
   require   => Postgresql::User['marmot'],
}

etc, etc.

Automated testing

Install and setup an RVM with vagrant, sahara, and rspec

$ curl -L get.rvm.io | bash -s stable
$ rvm install 1.9.3
$ rvm use --create 1.9.3@puppet-postgresql
$ gem install vagrant sahara rspec

Run the tests like so:

$ (cd spec; vagrant up)
$ rspec -f -d -c

The test suite will snapshot the VM and rollback between each test.

Next, take a look at the manifests used for the automated tests.

spec/
    manifests/
        test_*.pp

Contributors

Copyright 2012 Inkling Systems, Inc.

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.