diff --git a/manifests/server.pp b/manifests/server.pp index 9f9ad63..31e8c63 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -23,11 +23,10 @@ class icinga2::server ( #$server_db_schema_path = $icinga2::params::server_db_schema_path ) inherits icinga2::params { - + #Pick set the right path where we can find the DB schema based on the OS... case $operatingsystem { - #Red Hat/CentOS systems: 'RedHat', 'CentOS': { - #Pick set the right path where we can find the DB schema + #...and database that the user picks case $server_db_type { 'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' } 'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' } diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 1a2604a..e9043c2 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -109,6 +109,7 @@ class icinga2::server::install::execs inherits icinga2::server { require => Class['icinga2::server::install::packages'], } } + #Schema loading for Postgres: 'pgsql': { exec { 'postgres_schema_load': @@ -118,9 +119,16 @@ class icinga2::server::install::execs inherits icinga2::server { creates => "/etc/icinga2/postgres_schema_loaded.txt", require => Class['icinga2::server::install::packages'], } + + exec { 'postgres_module_enable': + user => 'root', + path => '/usr/bin:/usr/sbin:/bin/:/sbin', + command => "/usr/sbin/icinga2-enable-feature ido-pgsql; touch /etc/icinga2/postgres_module_loaded.txt", + creates => "/etc/icinga2/postgres_module_loaded.txt", + require => Exec['postgres_schema_load'], + } } - + default: { fail("${server_db_type} is not supported!") } } - } \ No newline at end of file