Vagrant: Add icinga_unittest databases

refs #4442
This commit is contained in:
Eric Lippmann 2013-07-29 18:35:40 +02:00
parent f47747255e
commit bcf53cbbd5
2 changed files with 26 additions and 2 deletions

View File

@ -14,8 +14,10 @@ exec { 'create-mysql-icinga-db':
}
exec{ 'create-pgsql-icinga-db':
unless => 'sudo -u postgres psql -l 2> /dev/null | grep -s icinga',
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',
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']
}
@ -360,3 +362,19 @@ user { 'vagrant':
groups => 'icinga-cmd',
require => Group['icinga-cmd']
}
exec { 'create-mysql-icinga_unittest-db':
unless => 'mysql -uicinga_unittest -picinga_unittest icinga_unittest',
command => 'mysql -uroot -e "CREATE DATABASE icinga_unittest; \
GRANT ALL ON icinga_unittest.* TO icinga_unittest@localhost \
IDENTIFIED BY \'icinga_unittest\';"',
require => Service['mysqld']
}
exec{ 'create-pgsql-icinga_unittest-db':
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icinga_unittest\'" | grep -q 1',
command => 'sudo -u postgres psql -c "CREATE ROLE icinga_unittest WITH LOGIN PASSWORD \'icinga_unittest\';" && \
sudo -u postgres createdb -O icinga_unittest -E UTF8 icinga_unittest && \
sudo -u postgres createlang plpgsql icinga_unittest',
require => Service['postgresql']
}

View File

@ -70,6 +70,12 @@
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
# "local" is for Unix domain socket connections only
local all all ident
# IPv4 local connections: