icingaweb2_dev: add default user `icingaadmin'

This commit is contained in:
Alexander Klimov 2014-11-26 12:32:22 +01:00
parent 0bec42930b
commit 9e23ca0920
1 changed files with 12 additions and 0 deletions

View File

@ -57,18 +57,30 @@ class icingaweb2_dev {
require => Class['apache'], require => Class['apache'],
} }
$icingaadminSelect = "as CNT from icingaweb_user where name = \'icingaadmin\'\" |grep -qwe \'cnt=0\'"
$icingaadminInsert = "\"INSERT INTO icingaweb_user (name, active, password_hash) VALUES (\'icingaadmin\', 1, \'\\\$1\\\$JMdnEc9M\\\$FW7yapAjv0atS43NkapGo/\');\""
mysql::database::populate { 'icingaweb': mysql::database::populate { 'icingaweb':
username => 'icingaweb', username => 'icingaweb',
password => 'icingaweb', password => 'icingaweb',
privileges => 'ALL', privileges => 'ALL',
schemafile => '/vagrant/etc/schema/mysql.schema.sql', schemafile => '/vagrant/etc/schema/mysql.schema.sql',
} }
-> exec { 'mysql-icingaadmin':
onlyif => "mysql -uicingaweb -picingaweb icingaweb -e \"select CONCAT(\'cnt=\', COUNT(name)) ${icingaadminSelect}",
command => "mysql -uicingaweb -picingaweb icingaweb -e ${icingaadminInsert}",
}
pgsql::database::populate { 'icingaweb': pgsql::database::populate { 'icingaweb':
username => 'icingaweb', username => 'icingaweb',
password => 'icingaweb', password => 'icingaweb',
schemafile => '/vagrant/etc/schema/pgsql.schema.sql', schemafile => '/vagrant/etc/schema/pgsql.schema.sql',
} }
-> exec { 'pgsql-icingaadmin':
onlyif => "psql -U icingaweb -w -d icingaweb -c \"select 'cnt=' || COUNT(name) ${icingaadminSelect}",
command => "psql -U icingaweb -w -d icingaweb -c ${icingaadminInsert}",
environment => 'PGPASSWORD=icingaweb',
}
file { '/etc/httpd/conf.d/icingaweb.conf': file { '/etc/httpd/conf.d/icingaweb.conf':
source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf', source => 'puppet:////vagrant/.vagrant-puppet/files/etc/httpd/conf.d/icingaweb.conf',