Skip to content

Instantly share code, notes, and snippets.

@spscream
Last active November 21, 2015 06:27
Show Gist options
  • Save spscream/18829173458aa635ffa3 to your computer and use it in GitHub Desktop.
Save spscream/18829173458aa635ffa3 to your computer and use it in GitHub Desktop.
class profile::postgres {
class { 'postgresql::server':
ip_mask_deny_postgres_user => '0.0.0.0/32',
ip_mask_allow_all_users => '192.168.3.0/24',
listen_addresses => '*',
}
$databases = hiera_hash('postgresql_databases', {})
$roles = hiera_hash('postgresl_roles', {})
$database_grants = hiera_hash('postgresql_database_grants', {})
$table_grants = hiera_hash('postgresql_table_grants', {})
create_resources('::postgresql::server::db', $databases)
create_resources('::postgresql::server::role', $roles)
create_resources('::postgresql::server::database_grant', $database_grants)
create_resources('::postgresql::server::table_grant', $table_grants)
postgresql::server::pg_hba_rule { 'allow application network to access app database':
description => "Open up postgresql for access from 192.168.3.0/24",
type => 'host',
database => 'all',
user => 'all',
address => '192.168.3.0/24',
auth_method => 'md5',
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment