Vagrant: Create and populate Icinga 2 Web MySQL and PostgreSQL databases

refs #4464
This commit is contained in:
Eric Lippmann 2013-08-14 17:37:17 +02:00 committed by Jannis Moßhammer
parent 6928a806ab
commit 9b203ce698
3 changed files with 57 additions and 12 deletions

View File

@ -454,3 +454,35 @@ populate_monitoring_test_config_plugins{ ['test_hostcheck.pl', 'test_servicechec
Cmmi['icinga-mysql'], Cmmi['icinga-mysql'],
Cmmi['icinga-pgsql'] ] Cmmi['icinga-pgsql'] ]
} }
#
# Following section creates and populates MySQL and PostgreSQL Icinga 2 Web databases
#
exec { 'create-mysql-icingaweb-db':
unless => 'mysql -uicingaweb -picinga icingaweb',
command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \
GRANT ALL ON icingaweb.* TO icingaweb@localhost \
IDENTIFIED BY \'icinga\';"',
require => Service['mysqld']
}
exec{ 'create-pgsql-icingaweb-db':
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icingaweb\'" | grep -q 1',
command => 'sudo -u postgres psql -c "CREATE ROLE icingaweb WITH LOGIN PASSWORD \'icinga\';" && \
sudo -u postgres createdb -O icingaweb -E UTF8 icingaweb && \
sudo -u postgres createlang plpgsql icingaweb',
require => Service['postgresql']
}
exec { 'populate-icingaweb-mysql-db':
unless => 'mysql -uicingaweb -picinga icingaweb -e "SELECT * FROM account;" &> /dev/null',
command => 'mysql -uicingaweb -picinga icingaweb < /vagrant/etc/schema/users.mysql.sql',
require => [ Exec['create-mysql-icingaweb-db'] ]
}
exec { 'populate-icingweba-pgsql-db':
unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM account;" &> /dev/null',
command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/users.pgsql.sql',
require => [ Exec['create-pgsql-icingaweb-db'] ]
}

View File

@ -76,6 +76,11 @@ local icinga_unittest icinga_unittest trust
host icinga_unittest icinga_unittest 127.0.0.1/32 trust host icinga_unittest icinga_unittest 127.0.0.1/32 trust
host icinga_unittest icinga_unittest ::1/128 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
# "local" is for Unix domain socket connections only # "local" is for Unix domain socket connections only
local all all ident local all all ident
# IPv4 local connections: # IPv4 local connections:

View File

@ -6,7 +6,6 @@
## Vagrant ## Vagrant
> **Note** that the deployment of the virtual machine is tested against Vagrant starting with version 1.1. > **Note** that the deployment of the virtual machine is tested against Vagrant starting with version 1.1.
> Unfortunately older versions will not work. > Unfortunately older versions will not work.
@ -203,3 +202,12 @@ code style issues.
cd /usr/local/icinga2 cd /usr/local/icinga2
./sbin/icinga2 -c etc/icinga2/icinga2.conf.dist ./sbin/icinga2 -c etc/icinga2/icinga2.conf.dist
## Log into Icinga 2 Web
If you've configure LDAP as authentication backend (which is the default) use the following login credentials:
> **Username**: jdoe
> **Password**: password
Have a look at [LDAP example data](#ldap example data) for more accounts.