Profile `icingaweb2_dev': deduplicate DB creation/population

refs #6842
This commit is contained in:
Alexander Klimov 2014-09-09 13:19:12 +02:00
parent be7bae8cd6
commit 77719be042

View File

@ -1,37 +1,27 @@
class icingaweb2_dev {
mysql::database::create { 'icingaweb':
mysql::database::populate { 'icingaweb':
username => 'icingaweb',
password => 'icingaweb',
privileges => 'ALL',
schemafile => '/vagrant/etc/schema/accounts.mysql.sql',
}
pgsql::database::create { 'icingaweb':
pgsql::database::populate { 'icingaweb':
username => 'icingaweb',
password => 'icinga',
}
exec { 'populate-icingaweb-mysql-db-accounts':
unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM account;" &> /dev/null',
command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/accounts.mysql.sql',
require => [ Exec['create-mysql-icingaweb-db'] ]
}
exec { 'populate-icingweba-pgsql-db-accounts':
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/accounts.pgsql.sql',
require => [ Exec['create-pgsql-icingaweb-db'] ]
schemafile => '/vagrant/etc/schema/accounts.pgsql.sql',
}
exec { 'populate-icingaweb-mysql-db-preferences':
unless => 'mysql -uicingaweb -picingaweb icingaweb -e "SELECT * FROM preference;" &> /dev/null',
command => 'mysql -uicingaweb -picingaweb icingaweb < /vagrant/etc/schema/preferences.mysql.sql',
require => [ Exec['create-mysql-icingaweb-db'] ]
require => Mysql::Database::Populate['icingaweb'],
}
exec { 'populate-icingweba-pgsql-db-preferences':
exec { 'populate-icingweb-pgsql-db-preferences':
unless => 'psql -U icingaweb -d icingaweb -c "SELECT * FROM preference;" &> /dev/null',
command => 'sudo -u postgres psql -U icingaweb -d icingaweb -f /vagrant/etc/schema/preferences.pgsql.sql',
require => [ Exec['create-pgsql-icingaweb-db'] ]
require => Pgsql::Database::Populate['icingaweb'],
}
file { '/etc/httpd/conf.d/icingaweb.conf':