Implement Vagrant support for ido-pgsql.

Fixes #5001
This commit is contained in:
Gunnar Beutner 2013-11-05 11:19:21 +01:00
parent 54111b6293
commit eafdb48ffe
5 changed files with 44 additions and 42 deletions

View File

@ -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'],

View File

@ -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}":

View File

@ -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

View File

@ -1,5 +1,5 @@
/**
* The ido_mysql library implements IDO functionality
* The db_ido_mysql library implements IDO functionality
* for MySQL.
*/

View File

@ -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",