parent
5f977328a9
commit
4dc1541459
|
@ -6,13 +6,11 @@ define pgsql::database::create ($username, $password) {
|
|||
command => "sudo -u postgres psql -c \"CREATE ROLE ${username} WITH LOGIN PASSWORD '${password}';\" && \
|
||||
sudo -u postgres createdb -O ${username} -E UTF8 -T template0 ${name} && \
|
||||
sudo -u postgres createlang plpgsql ${name}",
|
||||
require => Service['postgresql']
|
||||
require => Class['pgsql']
|
||||
}
|
||||
}
|
||||
|
||||
define pgsql::database::populate ($username, $password, $schemafile, $requirement) {
|
||||
include pgsql
|
||||
|
||||
define pgsql::database::populate ($username, $password, $schemafile) {
|
||||
pgsql::database::create { $name:
|
||||
username => $username,
|
||||
password => $password,
|
||||
|
@ -21,6 +19,6 @@ define pgsql::database::populate ($username, $password, $schemafile, $requiremen
|
|||
exec { "populate-${name}-pgsql-db":
|
||||
unless => "psql -U ${username} -d ${name} -c \"SELECT * FROM icinga_dbversion;\" &> /dev/null",
|
||||
command => "sudo -u postgres psql -U ${username} -d ${name} < ${schemafile}",
|
||||
require => [ $requirement, Exec["create-pgsql-${name}-db"] ]
|
||||
require => Pgsql::Database::Create[$name],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,6 @@ class profile::icinga-pgsql ($icingaVersion) {
|
|||
username => 'icinga',
|
||||
password => 'icingaweb',
|
||||
schemafile => "/usr/local/src/icinga-pgsql/icinga-${icingaVersion}/module/idoutils/db/pgsql/pgsql.sql",
|
||||
requirement => Cmmi['icinga-pgsql'],
|
||||
require => Cmmi['icinga-pgsql'],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue