Add extra clause for Debian/Ubuntu in db initialization step
This commit is contained in:
parent
41c46bdf02
commit
475e0c9cfc
1 changed files with 25 additions and 2 deletions
|
@ -5,7 +5,7 @@
|
||||||
class icingaweb2::initialize {
|
class icingaweb2::initialize {
|
||||||
if $::icingaweb2::initialize {
|
if $::icingaweb2::initialize {
|
||||||
case $::operatingsystem {
|
case $::operatingsystem {
|
||||||
'RedHat', 'CentOS', 'Debian', 'Ubuntu': {
|
'RedHat', 'CentOS': {
|
||||||
case $::icingaweb2::web_db {
|
case $::icingaweb2::web_db {
|
||||||
'mysql': {
|
'mysql': {
|
||||||
|
|
||||||
|
@ -15,6 +15,30 @@ class icingaweb2::initialize {
|
||||||
$sql_schema_location = '/usr/share/doc/icingaweb2/schema/mysql.schema.sql'
|
$sql_schema_location = '/usr/share/doc/icingaweb2/schema/mysql.schema.sql'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exec { 'create db scheme':
|
||||||
|
command => "mysql --defaults-file='/root/.my.cnf' ${::icingaweb2::web_db_name} < ${sql_schema_location}",
|
||||||
|
unless => "mysql --defaults-file='/root/.my.cnf' ${::icingaweb2::web_db_name} -e \"SELECT 1 FROM icingaweb_user LIMIT 1;\"",
|
||||||
|
notify => Exec['create web user']
|
||||||
|
}
|
||||||
|
|
||||||
|
exec { 'create web user':
|
||||||
|
command => "mysql --defaults-file='/root/.my.cnf' ${::icingaweb2::web_db_name} -e \" INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, '\\\$1\\\$EzxLOFDr\\\$giVx3bGhVm4lDUAw6srGX1');\"",
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default: {
|
||||||
|
fail "DB type ${::icingaweb2::web_db} not supported yet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
'Debian', 'Ubuntu': {
|
||||||
|
case $::icingaweb2::web_db {
|
||||||
|
'mysql': {
|
||||||
|
|
||||||
|
$sql_schema_location = '/usr/share/icingaweb2/etc/schema/mysql.schema.sql'
|
||||||
|
|
||||||
exec { 'create db scheme':
|
exec { 'create db scheme':
|
||||||
command => "mysql -h ${::icingaweb2::web_db_host} -u${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} < ${sql_schema_location}",
|
command => "mysql -h ${::icingaweb2::web_db_host} -u${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} < ${sql_schema_location}",
|
||||||
unless => "mysql -h ${::icingaweb2::web_db_host} -u${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} -e \"SELECT 1 FROM icingaweb_user LIMIT 1;\"",
|
unless => "mysql -h ${::icingaweb2::web_db_host} -u${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} -e \"SELECT 1 FROM icingaweb_user LIMIT 1;\"",
|
||||||
|
@ -39,4 +63,3 @@ class icingaweb2::initialize {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue