Skip to content

Commit

Permalink
fix #65 Add parameter for initial admin user and password to Icinga W…
Browse files Browse the repository at this point in the history
…eb 2
  • Loading branch information
lbetz committed Jul 26, 2022
1 parent a3d5b43 commit a326ecd
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 39 deletions.
18 changes: 10 additions & 8 deletions examples/mysql/standalone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
}

class { '::icinga::web':
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'icingaweb2',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'mysql',
db_host => 'localhost',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { '::icinga::web::director':
Expand Down
18 changes: 10 additions & 8 deletions examples/pgsql/standalone.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
}

class { '::icinga::web':
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'icingaweb2',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
backend_db_type => $icinga::ido::db_type,
backend_db_host => $icinga::ido::db_host,
backend_db_pass => $icinga::ido::db_pass,
db_type => 'pgsql',
db_host => 'localhost',
db_pass => 'icingaweb2',
default_admin_user => 'admin',
default_admin_pass => 'admin',
manage_database => true,
api_pass => $icinga::server::web_api_pass,
}

class { '::icinga::web::director':
Expand Down
56 changes: 33 additions & 23 deletions manifests/web.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# @summary
# Setup Icinga Web 2 including a database backend for user settings.
#
# @param default_admin_user
# Set the initial name of the admin user.
#
# @param default_admin_pass
# Set the initial password for the admin user.
#
# @param db_pass
# Password to connect the database.
#
Expand Down Expand Up @@ -58,19 +64,21 @@
String $api_pass,
Boolean $apache_cgi_pass_auth,
String $backend_db_pass,
Enum['mysql', 'pgsql'] $db_type = 'mysql',
Stdlib::Host $db_host = 'localhost',
Optional[Stdlib::Port::Unprivileged] $db_port = undef,
String $db_name = 'icingaweb2',
String $db_user = 'icingaweb2',
Boolean $manage_database = false,
Variant[Stdlib::Host, Array[Stdlib::Host]] $api_host = 'localhost',
String $api_user = 'icingaweb2',
Enum['mysql', 'pgsql'] $backend_db_type = 'mysql',
Stdlib::Host $backend_db_host = 'localhost',
Optional[Stdlib::Port::Unprivileged] $backend_db_port = undef,
String $backend_db_name = 'icinga2',
String $backend_db_user = 'icinga2',
String $default_admin_user = 'icingaadmin',
String $default_admin_pass = 'icingaadmin',
Enum['mysql', 'pgsql'] $db_type = 'mysql',
Stdlib::Host $db_host = 'localhost',
Optional[Stdlib::Port::Unprivileged] $db_port = undef,
String $db_name = 'icingaweb2',
String $db_user = 'icingaweb2',
Boolean $manage_database = false,
Variant[Stdlib::Host, Array[Stdlib::Host]] $api_host = 'localhost',
String $api_user = 'icingaweb2',
Enum['mysql', 'pgsql'] $backend_db_type = 'mysql',
Stdlib::Host $backend_db_host = 'localhost',
Optional[Stdlib::Port::Unprivileged] $backend_db_port = undef,
String $backend_db_name = 'icinga2',
String $backend_db_user = 'icinga2',
) {

unless $backend_db_port {
Expand Down Expand Up @@ -234,16 +242,18 @@
# Icinga Web 2
#
class { 'icingaweb2':
db_type => $db_type,
db_host => $_db_host,
db_port => $_db_port,
db_name => $db_name,
db_username => $db_user,
db_password => $db_pass,
import_schema => lookup('icingaweb2::import_schema', undef, undef, true),
config_backend => 'db',
conf_user => $web_conf_user,
manage_package => $manage_package,
db_type => $db_type,
db_host => $_db_host,
db_port => $_db_port,
db_name => $db_name,
db_username => $db_user,
db_password => $db_pass,
default_admin_username => $default_admin_user,
default_admin_password => $default_admin_pass,
import_schema => lookup('icingaweb2::import_schema', undef, undef, true),
config_backend => 'db',
conf_user => $web_conf_user,
manage_package => $manage_package,
}

class { '::icingaweb2::module::monitoring':
Expand Down

0 comments on commit a326ecd

Please sign in to comment.