-
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: initialize database if preferred so a working icingaweb2 ins…
…tance can be started automatically
- Loading branch information
1 parent
df2c668
commit df99507
Showing
5 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# == Class icingaweb2::initialize | ||
# | ||
# This class is used to initialize a default icingaweb2 db and user | ||
# Depends on the pupppetlabs-mysql module | ||
class icingaweb2::initialize { | ||
if $::icingaweb2::initialize { | ||
case $::operatingsystem { | ||
'RedHat', 'CentOS': { | ||
case $::icingaweb2::web_db { | ||
'mysql': { | ||
exec { 'create db scheme': | ||
command => "mysql -u ${::icingaweb2::web_db_user} -p${::icingaweb2::web_db_pass} ${::icingaweb2::web_db_name} < /usr/share/doc/icingaweb2/schema/mysql.schema.sql", | ||
onlyif => 'test -f /root/.my.cnf', | ||
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');\"", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
visibilityspots
Author
Contributor
|
||
refreshonly => true, | ||
} | ||
} | ||
|
||
default: { | ||
fail "DB type ${::icingaweb2::web_db} not supported yet" | ||
} | ||
} | ||
} | ||
|
||
default: { | ||
fail "Managing repositories for ${::operatingsystem} is not supported." | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What password is this? Why not use variable expansion here?