Outsource 'icingaweb' database creation into pgsql::database::create

refs #6842
This commit is contained in:
Alexander Klimov 2014-08-05 15:20:43 +02:00
parent 9a50cb8fa3
commit ee711679e6
1 changed files with 3 additions and 6 deletions

View File

@ -581,12 +581,9 @@ exec { 'create-mysql-icingaweb-db':
require => Service['mysqld'] require => Service['mysqld']
} }
exec { 'create-pgsql-icingaweb-db': pgsql::database::create { 'icingaweb':
unless => 'sudo -u postgres psql -tAc "SELECT 1 FROM pg_roles WHERE rolname=\'icingaweb\'" | grep -q 1', username => 'icingaweb',
command => 'sudo -u postgres psql -c "CREATE ROLE icingaweb WITH LOGIN PASSWORD \'icinga\';" && \ password => 'icinga',
sudo -u postgres createdb -O icingaweb -E UTF8 -T template0 icingaweb && \
sudo -u postgres createlang plpgsql icingaweb',
require => Service['postgresql']
} }
exec { 'populate-icingaweb-mysql-db-accounts': exec { 'populate-icingaweb-mysql-db-accounts':