summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2019-06-11 18:50:29 +0000
committerintrigeri <intrigeri@boum.org>2019-06-11 18:50:29 +0000
commit8731ea2c608f48c8e93179796e2b9e79cd528e9c (patch)
tree4b41aba8271df800186aee22a91ffe5503c46202
parentbd354e5f7ed0ad937fe2370c542fec5c1380ea1d (diff)
Start porting to puppet-icingaweb2 v2.3.0 (#16173)feature16173
Adjust to the new API and rename parameters and variables to be consistent with it.
-rw-r--r--files/monitoring/icingaweb2/scripts/install_icingaweb2_database8
-rw-r--r--manifests/monitoring/config/ido.pp6
-rw-r--r--manifests/monitoring/icingaweb2.pp47
-rw-r--r--manifests/monitoring/icingaweb2/mysql.pp12
-rw-r--r--manifests/monitoring/master.pp40
-rw-r--r--templates/monitoring/icingaweb2/dbconfig-common/icinga2-ido-mysql.conf.erb6
6 files changed, 61 insertions, 58 deletions
diff --git a/files/monitoring/icingaweb2/scripts/install_icingaweb2_database b/files/monitoring/icingaweb2/scripts/install_icingaweb2_database
index 32342f3..fd7d2ae 100644
--- a/files/monitoring/icingaweb2/scripts/install_icingaweb2_database
+++ b/files/monitoring/icingaweb2/scripts/install_icingaweb2_database
@@ -6,19 +6,19 @@ set -u
db_name="$1"
db_user="$2"
db_pass="$3"
-web_user_pass="$4"
+web_user_password="$4"
[ "$db_name" ] || exit 2
[ "$db_user" ] || exit 3
[ "$db_pass" ] || exit 4
-[ "$web_user_pass" ] || exit 5
+[ "$web_user_password" ] || exit 5
-web_user_pass_hash=$(openssl passwd -1 "${web_user_pass}")
+web_user_password_hash=$(openssl passwd -1 "${web_user_password}")
mysql -u "$db_user" -p"$db_pass" "$db_name" < /usr/share/icingaweb2/etc/schema/mysql.schema.sql
mysql -u "$db_user" -p"$db_pass" "$db_name" <<EOF
-INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, "${web_user_pass_hash}");
+INSERT INTO icingaweb_user (name, active, password_hash) VALUES ('icingaadmin', 1, "${web_user_password_hash}");
INSERT INTO icingaweb_group (id, name) VALUES (1, 'Administrators');
INSERT INTO icingaweb_group_membership (group_id, username) VALUES (1,'icingaadmin');
EOF
diff --git a/manifests/monitoring/config/ido.pp b/manifests/monitoring/config/ido.pp
index 578cf5d..3f7336b 100644
--- a/manifests/monitoring/config/ido.pp
+++ b/manifests/monitoring/config/ido.pp
@@ -1,9 +1,9 @@
# Manage the installation of ido database feature.
class tails::monitoring::config::ido (
String $ido_db_name,
- String $ido_db_user,
- String $ido_db_pass,
- String $db_admin_pass,
+ String $ido_db_username,
+ String $ido_db_password,
+ String $db_admin_password,
Enum['present', 'absent'] $ensure = present,
){
diff --git a/manifests/monitoring/icingaweb2.pp b/manifests/monitoring/icingaweb2.pp
index 5ae53e8..37e4e39 100644
--- a/manifests/monitoring/icingaweb2.pp
+++ b/manifests/monitoring/icingaweb2.pp
@@ -2,15 +2,15 @@
# Requires the nginx puppet module and the puppetlabs/stdlib one.
#
class tails::monitoring::icingaweb2 (
- String $ido_db,
+ String $ido_type,
String $ido_db_name,
- String $ido_db_user,
- String $ido_db_pass,
- String $web_db,
+ String $ido_db_username,
+ String $ido_db_password,
+ String $web_db_type,
String $web_db_name,
- String $web_db_user,
- String $web_db_pass,
- String $web_user_pass,
+ String $web_db_username,
+ String $web_db_password,
+ String $web_user_password,
Stdlib::Fqdn $webserver_hostname,
String $web_admins = 'icingaadmin',
Enum['present', 'absent'] $ensure = present,
@@ -27,11 +27,11 @@ class tails::monitoring::icingaweb2 (
}
class { '::tails::monitoring::icingaweb2::mysql':
- ensure => $ensure,
- web_db_pass => $web_db_pass,
- web_db_name => $web_db_name,
- web_db_user => $web_db_user,
- web_user_pass => $web_user_pass,
+ ensure => $ensure,
+ web_db_password => $web_db_password,
+ web_db_name => $web_db_name,
+ web_db_username => $web_db_username,
+ web_user_password => $web_user_password,
}
$packages = [
@@ -54,20 +54,23 @@ class tails::monitoring::icingaweb2 (
}
class { '::icingaweb2':
- initialize => false,
install_method => 'package',
- ido_db => $ido_db,
- ido_db_pass => $ido_db_pass,
- ido_db_name => $ido_db_name,
- ido_db_user => $ido_db_user,
- web_db => $web_db,
- web_db_pass => $web_db_pass,
- web_db_name => $web_db_name,
- web_db_user => $web_db_user,
+ db_type => $web_db_type,
+ db_name => $web_db_name,
+ db_username => $web_db_username,
+ db_password => $web_db_password,
admin_users => $web_admins,
require => Package[$packages],
}
- class { '::icingaweb2::mod::monitoring': }
+ class { '::icingaweb2::module::monitoring':
+ ido_type => $ido_type,
+ ido_db_name => $ido_db_name,
+ ido_db_username => $ido_db_username,
+ ido_db_password => $ido_db_password,
+ icinga2 => {
+ transport => 'local',
+ }
+ }
}
diff --git a/manifests/monitoring/icingaweb2/mysql.pp b/manifests/monitoring/icingaweb2/mysql.pp
index a34972e..5f42b65 100644
--- a/manifests/monitoring/icingaweb2/mysql.pp
+++ b/manifests/monitoring/icingaweb2/mysql.pp
@@ -2,9 +2,9 @@
# Icingaweb2 package doesn't use dbconfig (Debian#831532)
class tails::monitoring::icingaweb2::mysql (
String $web_db_name,
- String $web_db_user,
- String $web_db_pass,
- String $web_user_pass,
+ String $web_db_username,
+ String $web_db_password,
+ String $web_user_password,
Enum['present', 'absent'] $ensure = present,
){
@@ -24,8 +24,8 @@ class tails::monitoring::icingaweb2::mysql (
# utf8mb4_general_ci).
charset => 'latin1',
collate => 'latin1_swedish_ci',
- user => $web_db_user,
- password => $web_db_pass,
+ user => $web_db_username,
+ password => $web_db_password,
host => 'localhost',
grant => ['ALL'],
tag => "mysql_${::fqdn}",
@@ -50,7 +50,7 @@ class tails::monitoring::icingaweb2::mysql (
exec { 'install_web_database':
user => 'icingaweb2',
group => 'icingaweb2',
- command => "/usr/local/sbin/install_icingaweb2_database '${web_db_name}' '${web_db_user}' '${web_db_pass}' '${web_user_pass}'",
+ command => "/usr/local/sbin/install_icingaweb2_database '${web_db_name}' '${web_db_username}' '${web_db_password}' '${web_user_password}'",
creates => '/var/lib/icingaweb2/.db_installed',
require => [
Mysql::Db[$web_db_name],
diff --git a/manifests/monitoring/master.pp b/manifests/monitoring/master.pp
index 7c28a8b..509eb5f 100644
--- a/manifests/monitoring/master.pp
+++ b/manifests/monitoring/master.pp
@@ -8,21 +8,21 @@
# database.
class tails::monitoring::master (
- String $ido_db_pass,
- String $web_db_pass,
- Pattern[/\A\w+\z/] $web_user_pass,
- String $db_admin_pass,
+ String $ido_db_password,
+ String $web_db_password,
+ Pattern[/\A\w+\z/] $web_user_password,
+ String $db_admin_password,
String $email_recipient = 'root',
Enum['present', 'absent'] $ensure = 'present',
Stdlib::IP::Address::V4 $ip = $::ipaddress,
String $zone = 'Tails',
String $nodename = $::fqdn,
- String $ido_db = 'mysql',
+ String $ido_type = 'mysql',
String $ido_db_name = 'icinga2',
- String $ido_db_user = 'icinga2',
- String $web_db = 'mysql',
+ String $ido_db_username = 'icinga2',
+ String $web_db_type = 'mysql',
String $web_db_name = 'icingaweb2',
- String $web_db_user = 'icingaweb2',
+ String $web_db_username = 'icingaweb2',
Stdlib::Fqdn $webserver_hostname = 'icingaweb2.tails.boum.org',
String $web_admins = 'icingaadmin',
){
@@ -95,24 +95,24 @@ class tails::monitoring::master (
include ::mysql::server
class { '::tails::monitoring::config::ido':
- ensure => $ensure,
- ido_db_name => $ido_db_name,
- ido_db_user => $ido_db_user,
- ido_db_pass => $ido_db_pass,
- db_admin_pass => $db_admin_pass,
+ ensure => $ensure,
+ ido_db_name => $ido_db_name,
+ ido_db_username => $ido_db_username,
+ ido_db_password => $ido_db_password,
+ db_admin_password => $db_admin_password,
}
class { '::tails::monitoring::icingaweb2':
ensure => $ensure,
- ido_db => $ido_db,
+ ido_type => $ido_type,
ido_db_name => $ido_db_name,
- ido_db_user => $ido_db_user,
- ido_db_pass => $ido_db_pass,
- web_db => $web_db,
+ ido_db_username => $ido_db_username,
+ ido_db_password => $ido_db_password,
+ web_db_type => $web_db_type,
web_db_name => $web_db_name,
- web_db_user => $web_db_user,
- web_db_pass => $web_db_pass,
- web_user_pass => $web_user_pass,
+ web_db_username => $web_db_username,
+ web_db_password => $web_db_password,
+ web_user_password => $web_user_password,
webserver_hostname => $webserver_hostname,
web_admins => $web_admins,
require => [
diff --git a/templates/monitoring/icingaweb2/dbconfig-common/icinga2-ido-mysql.conf.erb b/templates/monitoring/icingaweb2/dbconfig-common/icinga2-ido-mysql.conf.erb
index eeb042e..17e725a 100644
--- a/templates/monitoring/icingaweb2/dbconfig-common/icinga2-ido-mysql.conf.erb
+++ b/templates/monitoring/icingaweb2/dbconfig-common/icinga2-ido-mysql.conf.erb
@@ -24,12 +24,12 @@ dbc_dbtype='mysql'
# dbc_dbuser: database user
# the name of the user who we will use to connect to the database.
-dbc_dbuser='<%= @ido_db_user %>'
+dbc_dbuser='<%= @ido_db_username %>'
# dbc_dbpass: database user password
# the password to use with the above username when connecting
# to a database, if one is required
-dbc_dbpass='<%= @ido_db_pass %>'
+dbc_dbpass='<%= @ido_db_password %>'
# dbc_dbserver: database host.
# leave unset to use localhost (or a more efficient local method
@@ -48,7 +48,7 @@ dbc_dbname='<%= @ido_db_name %>'
# dbc_dbadmin: name of the administrative user
# this is the administrative user that is used to create all of the above
dbc_dbadmin='root'
-dbc_dbadmpass='<%= @db_admin_pass %>'
+dbc_dbadmpass='<%= @db_admin_password %>'
# dbc_basepath: base directory to hold database files
# leave unset to use the default. only applicable if you are