diff --git a/manifests/params.pp b/manifests/params.pp index dbf3774..fd4c4b3 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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 diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 6a7a0bc..aaddd04 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -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!") } } } \ No newline at end of file