Added Postgres schema loading; added database connection info parameters.

This commit is contained in:
Nick Chappell 2014-07-02 19:53:53 -07:00
parent 0cd1b80733
commit 4fa10d3d32
2 changed files with 15 additions and 3 deletions

View file

@ -17,6 +17,12 @@ class icinga2::params {
$manage_repos = 'true'
$server_db_type = 'pgsql'
#Database paramters
$db_name = 'icinga2_data'
$db_user = 'icinga2'
$db_password = 'password'
$db_host = 'localhost'
##############################
# Icinga 2 server package parameters

View file

@ -98,17 +98,23 @@ class icinga2::server::install::execs inherits icinga2::server {
include icinga2::params
case $icinga::params::server_db_type {
case $server_db_type {
#Schema loading for MySQL:
'mysql': {
}
#Schema loading for Postgres:
'pgsql': {
exec { 'postgres_schema_load':
user => 'root',
path => '/usr/bin:/usr/sbin:/bin/:/sbin',
command => "su postgres -c 'psql -d ${db_name} < /usr/share/icinga2-ido-pgsql/schema/pgsql.sql'; touch /etc/icinga2/postgres_schema_loaded.txt",
creates => "/etc/icinga2/postgres_schema_loaded.txt",
require => Class['icinga2::server::install::packages'],
}
}
default: { fail("${icinga2::params::server_db_type} is not supported!") }
default: { fail("${server_db_type} is not supported!") }
}
}