2013-10-21 17:21:12 +02:00
|
|
|
# Class for creating the PuppetDB postgresql database. See README.md for more
|
|
|
|
# information.
|
2012-09-18 00:26:32 +02:00
|
|
|
class puppetdb::database::postgresql(
|
2015-01-14 11:15:16 +01:00
|
|
|
$listen_addresses = $puppetdb::params::database_host,
|
|
|
|
$database_name = $puppetdb::params::database_name,
|
|
|
|
$database_username = $puppetdb::params::database_username,
|
|
|
|
$database_password = $puppetdb::params::database_password,
|
2015-08-05 14:37:57 +02:00
|
|
|
$database_port = $puppetdb::params::database_port,
|
2015-01-14 11:15:16 +01:00
|
|
|
$manage_server = $puppetdb::params::manage_dbserver,
|
|
|
|
$manage_package_repo = $puppetdb::params::manage_pg_repo,
|
|
|
|
$postgres_version = $puppetdb::params::postgres_version,
|
2012-09-18 00:26:32 +02:00
|
|
|
) inherits puppetdb::params {
|
|
|
|
|
2015-01-14 11:15:16 +01:00
|
|
|
if $manage_server {
|
2015-06-24 18:10:32 +02:00
|
|
|
class { '::postgresql::globals':
|
|
|
|
manage_package_repo => $manage_package_repo,
|
|
|
|
version => $postgres_version,
|
2015-01-14 11:15:16 +01:00
|
|
|
}
|
2014-10-07 16:06:54 +02:00
|
|
|
# get the pg server up and running
|
2014-02-20 21:35:16 +01:00
|
|
|
class { '::postgresql::server':
|
|
|
|
ip_mask_allow_all_users => '0.0.0.0/0',
|
|
|
|
listen_addresses => $listen_addresses,
|
2015-08-05 14:37:57 +02:00
|
|
|
port => $database_port,
|
2014-02-20 21:35:16 +01:00
|
|
|
}
|
2016-04-02 16:39:19 +02:00
|
|
|
# get the pg contrib to use pg_trgm extension
|
|
|
|
class { '::postgresql::server::contrib': }
|
2016-05-10 09:45:41 +02:00
|
|
|
postgresql::server::extension { 'pg_trgm':
|
|
|
|
database => $database_name,
|
|
|
|
}
|
2012-09-20 23:46:26 +02:00
|
|
|
}
|
2012-09-18 00:26:32 +02:00
|
|
|
|
2012-09-20 23:46:26 +02:00
|
|
|
# create the puppetdb database
|
2013-10-21 17:21:12 +02:00
|
|
|
postgresql::server::db { $database_name:
|
|
|
|
user => $database_username,
|
|
|
|
password => $database_password,
|
|
|
|
grant => 'all',
|
2012-09-20 23:46:26 +02:00
|
|
|
}
|
2012-09-18 00:26:32 +02:00
|
|
|
}
|