Created
June 17, 2015 12:01
-
-
Save nini/310cf73241d01bb3b1f3 to your computer and use it in GitHub Desktop.
Puppet postgres ltree module for multiple databases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# PostgreSQL module | |
# | |
# | |
## wraps puppetlabs/postgresql | |
## https://forge.puppetlabs.com/puppetlabs/postgresql | |
class mystack::postgresql { | |
class { 'postgresql::globals': | |
manage_package_repo => true, | |
version => '9.3', | |
}-> | |
class { 'postgresql::server': | |
ip_mask_deny_postgres_user => '0.0.0.0/32', | |
ip_mask_allow_all_users => '0.0.0.0/0', | |
listen_addresses => '*', | |
ipv4acls => ['hostssl all johndoe 192.168.0.0/24 cert'], | |
postgres_password => 'pass', | |
} | |
postgresql::server::db { 'dev': | |
user => 'dev', | |
password => postgresql_password('dev', 'dev'), | |
} -> | |
postgresql::server::db { 'testing': | |
user => 'testing', | |
password => postgresql_password('testing', 'testing'), | |
} -> | |
postgresql::server::db { 'live': | |
user => 'live', | |
password => postgresql_password('live', 'live'), | |
} | |
class { 'postgresql::server::contrib': | |
package_ensure => 'present', | |
} -> | |
exec { "/usr/bin/psql -d dev -c 'CREATE EXTENSION ltree' && /etc/init.d/postgresql restart": | |
user => "postgres", | |
require => Postgresql::Server::Database[dev], | |
unless => "/usr/bin/psql -d dev -c '\\dx' | grep ltree", | |
} -> | |
exec { "/usr/bin/psql -d live -c 'CREATE EXTENSION ltree' && /etc/init.d/postgresql restart": | |
user => "postgres", | |
require => Postgresql::Server::Database[live], | |
unless => "/usr/bin/psql -d live -c '\\dx' | grep ltree", | |
} -> | |
exec { "/usr/bin/psql -d testing -c 'CREATE EXTENSION ltree' && /etc/init.d/postgresql restart": | |
user => "postgres", | |
require => Postgresql::Server::Database[testing], | |
unless => "/usr/bin/psql -d testing -c '\\dx' | grep ltree", | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment