Database name, user name and password can be set to arbitrary values.

This commit is contained in:
Karel Brezina 2013-02-13 12:14:53 +01:00
parent 9d4357de7f
commit 1d83efbcec
2 changed files with 22 additions and 10 deletions

View file

@ -13,12 +13,18 @@
# be compatible with puppetdb.
#
# Parameters:
# ['listen_addresses'] - A comma-separated list of hostnames or IP addresses
# on which the postgres server should listen for incoming
# connections. (Defaults to 'localhost'. This parameter
# maps directly to postgresql's 'listen_addresses' config
# option; use a '*' to allow connections on any accessible
# address.
# ['listen_addresses'] - A comma-separated list of hostnames or IP addresses
# on which the postgres server should listen for incoming
# connections. (Defaults to 'localhost'. This parameter
# maps directly to postgresql's 'listen_addresses' config
# option; use a '*' to allow connections on any accessible
# address.
# ['database_name'] - The name of the database instance to connect to.
# (defaults to `puppetdb`)
# ['database_username'] - The name of the database user to connect as.
# (defaults to `puppetdb`)
# ['database_password'] - The password for the database user.
# (defaults to `puppetdb`)
# Actions:
# - Creates and manages a postgres server and database instance for use by
# puppetdb
@ -35,6 +41,9 @@ class puppetdb::database::postgresql(
# TODO: expose more of the parameters from `inkling/postgresql`!
$listen_addresses = $puppetdb::params::database_host,
$manage_redhat_firewall = $puppetdb::params::open_postgres_port,
$database_name = $puppetdb::params::database_name,
$database_username = $puppetdb::params::database_username,
$database_password = $puppetdb::params::database_password,
) inherits puppetdb::params {
# This technically defaults to 'true', but in order to preserve backwards
@ -61,9 +70,9 @@ class puppetdb::database::postgresql(
}
# create the puppetdb database
postgresql::db{ 'puppetdb':
user => 'puppetdb',
password => 'puppetdb',
postgresql::db{ $database_name:
user => $database_username,
password => $database_password,
grant => 'all',
require => Class['::postgresql::server'],
}

View file

@ -121,7 +121,10 @@ class puppetdb(
false => $manage_redhat_firewall,
undef => $open_postgres_port,
},
listen_addresses => $postgres_listen_addresses,
listen_addresses => $puppetdb::params::postgres_listen_addresses,
database_name => $database_name,
database_username => $database_username,
database_password => $database_password,
before => Class['puppetdb::server']
}
}