diff --git a/.vagrant-puppet/modules/icinga-web/manifests/init.pp b/.vagrant-puppet/modules/icinga-web/manifests/init.pp index 2c8ce7d35..379ce6398 100644 --- a/.vagrant-puppet/modules/icinga-web/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga-web/manifests/init.pp @@ -1,12 +1,17 @@ class icinga-web { include icinga-rpm-snapshot include icinga2-ido-mysql + include icinga2-ido-pgsql include mysql php::extension { ['php-mysql']: require => [ Class['mysql'] ] } + php::extension { ['php-pgsql']: + require => [ Class['pgsql'] ] + } + package { 'icinga-web': ensure => installed, require => Class['icinga-rpm-snapshot'], diff --git a/.vagrant-puppet/modules/icinga2/manifests/init.pp b/.vagrant-puppet/modules/icinga2/manifests/init.pp index 524aed5eb..f3f3177de 100644 --- a/.vagrant-puppet/modules/icinga2/manifests/init.pp +++ b/.vagrant-puppet/modules/icinga2/manifests/init.pp @@ -28,6 +28,7 @@ class icinga2 { class icinga2-ido-mysql { include icinga-rpm-snapshot + include mysql package { 'icinga2-ido-mysql': ensure => installed, @@ -35,7 +36,6 @@ class icinga2-ido-mysql { alias => 'icinga2-ido-mysql' } - # icinga 2 IDO config file { '/etc/icinga2/features-available/ido-mysql.conf': source => 'puppet:////vagrant/.vagrant-puppet/files/etc/icinga2/features-available/ido-mysql.conf', require => Package['icinga2'], @@ -49,7 +49,6 @@ class icinga2-ido-mysql { require => Service['mysqld'] } - # populate icinga2-ido-mysql db exec { 'populate-icinga2-ido-mysql-db': path => '/bin:/usr/bin:/sbin:/usr/sbin', unless => 'mysql -uicinga -picinga icinga -e "SELECT * FROM icinga_dbversion;" &> /dev/null', @@ -58,37 +57,40 @@ class icinga2-ido-mysql { } icinga2::feature { 'ido-mysql': - require => Exec['create-mysql-icinga2-ido-db'] + require => Exec['populate-icinga2-ido-mysql-db'] } } -#class icinga2-ido-pgsql { -# include icinga-rpm-snapshot -# -# package { 'icinga2-ido-pgsql': -# ensure => installed, -# require => Class['icinga-rpm-snapshot'], -# alias = 'icinga2-ido-pgsql' -# } -# -# exec { 'create-pgsql-icinga2-ido-db': -# unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1', -# command => 'sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD \'icinga\';" && \ -# sudo -u postgres createdb -O icinga -E UTF8 icinga && \ -# sudo -u postgres createlang plpgsql icinga', -# require => Service['postgresql'] -# } -# -# exec { 'populate-icinga2-ido-pgsql-db': -# unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null', -# command => 'sudo -u postgres psql -U icinga -d icinga < /usr/share/doc/icinga2-ido-pgsql-$(rpm -q icinga2-ido-mysql | cut -d\'-\' -f4)/schema/pgsql.sql', -# require => [ Package['icinga2-ido-pgsql'], Exec['create-pgsql-icinga2-ido-db'] ] -# } -# -# php::extension { ['php-pgsql']: -# require => [ Class['pgsql'] ] -# } -#} +class icinga2-ido-pgsql { + include icinga-rpm-snapshot + include pgsql + + package { 'icinga2-ido-pgsql': + ensure => installed, + require => Class['icinga-rpm-snapshot'], + alias => 'icinga2-ido-pgsql' + } + + exec { 'create-pgsql-icinga2-ido-db': + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga\'" | grep -q 1', + command => 'sudo -u postgres psql -c "CREATE ROLE icinga WITH LOGIN PASSWORD \'icinga\';" && \ + sudo -u postgres createdb -O icinga -E UTF8 icinga && \ + sudo -u postgres createlang plpgsql icinga', + require => Service['postgresql'] + } + + exec { 'populate-icinga2-ido-pgsql-db': + path => '/bin:/usr/bin:/sbin:/usr/sbin', + unless => 'psql -U icinga -d icinga -c "SELECT * FROM icinga_dbversion;" &> /dev/null', + command => 'sudo -u postgres psql -U icinga -d icinga < /usr/share/doc/icinga2-ido-pgsql-$(rpm -q icinga2-ido-pgsql | cut -d\'-\' -f4)/schema/pgsql.sql', + require => [ Package['icinga2-ido-pgsql'], Exec['create-pgsql-icinga2-ido-db'] ] + } + + icinga2::feature { 'ido-pgsql': + require => Exec['populate-icinga2-ido-pgsql-db'] + } +} define icinga2::feature ($feature = $title) { exec { "icinga2-feature-${feature}": diff --git a/.vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb b/.vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb index f6fb19ebf..f434b4802 100644 --- a/.vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb +++ b/.vagrant-puppet/modules/pgsql/templates/pg_hba.conf.erb @@ -71,15 +71,10 @@ local icinga icinga trust host icinga icinga 127.0.0.1/32 trust host icinga icinga ::1/128 trust -# icinga_unittest -local icinga_unittest icinga_unittest trust -host icinga_unittest icinga_unittest 127.0.0.1/32 trust -host icinga_unittest icinga_unittest ::1/128 trust - -# icingaweb -local icingaweb icingaweb trust -host icingaweb icingaweb 127.0.0.1/32 trust -host icingaweb icingaweb ::1/128 trust +# icinga +local icinga icinga trust +host icinga icinga 127.0.0.1/32 trust +host icinga icinga ::1/128 trust # "local" is for Unix domain socket connections only local all all ident diff --git a/etc/icinga2/features-available/ido-mysql.conf b/etc/icinga2/features-available/ido-mysql.conf index 8cff8539e..b85322f29 100644 --- a/etc/icinga2/features-available/ido-mysql.conf +++ b/etc/icinga2/features-available/ido-mysql.conf @@ -1,5 +1,5 @@ /** - * The ido_mysql library implements IDO functionality + * The db_ido_mysql library implements IDO functionality * for MySQL. */ diff --git a/etc/icinga2/features-available/ido-pgsql.conf b/etc/icinga2/features-available/ido-pgsql.conf index 2b245c426..c8b8dfd57 100644 --- a/etc/icinga2/features-available/ido-pgsql.conf +++ b/etc/icinga2/features-available/ido-pgsql.conf @@ -1,11 +1,11 @@ /** - * The ido_pgsql library implements IDO functionality + * The db_ido_pgsql library implements IDO functionality * for PostgreSQL. */ library "db_ido_pgsql" -object IdoMysqlConnection "ido-pgsql" { +object IdoPgsqlConnection "ido-pgsql" { //user = "icinga", //password = "icinga", //host = "localhost",