diff --git a/examples/mysql/database-mysql.pp b/examples/mysql/database-mysql.pp index 87f8e16..137c92f 100644 --- a/examples/mysql/database-mysql.pp +++ b/examples/mysql/database-mysql.pp @@ -12,8 +12,14 @@ db_pass => 'icinga2', } +class { '::icinga::db::database': + icingadb_instances => ['192.168.5.13', '192.168.5.23'], + db_type => 'mysql', + db_pass => 'icingadb', +} + class { '::icinga::web::database': - ido_instances => ['192.168.5.13', '192.168.5.23'], + web_instances => ['192.168.5.13', '192.168.5.23'], db_type => 'mysql', db_pass => 'icingaweb2', } diff --git a/examples/pgsql/database-pgsql.pp b/examples/pgsql/database-pgsql.pp index 79f1e41..c4d9a4d 100644 --- a/examples/pgsql/database-pgsql.pp +++ b/examples/pgsql/database-pgsql.pp @@ -8,8 +8,14 @@ db_pass => 'icinga2', } +class { '::icinga::db::database': + icingadb_instances => ['192.168.5.13', '192.168.5.23'], + db_type => 'pgsql', + db_pass => 'icingadb', +} + class { '::icinga::web::database': - ido_instances => ['192.168.5.13', '192.168.5.23'], + web_instances => ['192.168.5.13', '192.168.5.23'], db_type => 'pgsql', db_pass => 'icingaweb2', } diff --git a/manifests/db/database.pp b/manifests/db/database.pp new file mode 100644 index 0000000..42d4812 --- /dev/null +++ b/manifests/db/database.pp @@ -0,0 +1,50 @@ +# @summary +# Setup database for IcingaDB. +# +# @param [Enum['mysql','pgsql']] db_type +# What kind of database type to use. +# +# @param [Array[Stdlib::Host]] icingadb_instances +# List of Hosts to allow write access to the database. Usually an IcingaDB instance. +# +# @param [String] db_pass +# Password to connect the database. +# +# @param [String] db_name +# Name of the database. +# +# @param [String] db_user +# Database user name. +# +class icinga::db::database( + Enum['mysql','pgsql'] $db_type, + Array[Stdlib::Host] $icingadb_instances, + String $db_pass, + String $db_name = 'icingadb', + String $db_user = 'icingadb', +) { + + $_db_encoding = $db_type ? { + 'mysql' => 'utf8', + default => 'UTF8', + } + + ::icinga::database { "${db_type}-${db_name}": + db_type => $db_type, + db_name => $db_name, + db_user => $db_user, + db_pass => $db_pass, + access_instances => $icingadb_instances, + mysql_privileges => ['ALL'], + db_encoding => $_db_encoding, + } + + if $db_type == 'pgsql' { + postgresql::server::extension { "${db_name}-citext": + extension => 'citext', + database => $db_name, + package_name => 'postgresql-contrib', + } + } +} + diff --git a/manifests/redis.pp b/manifests/redis.pp new file mode 100644 index 0000000..4c84ac1 --- /dev/null +++ b/manifests/redis.pp @@ -0,0 +1,13 @@ +class icinga::redis { + class { 'redis': + manage_repo => false, + manage_package => false, + default_install => false, + ulimit_managed => false, + service_manage => false, + config_owner => 'root', + config_group => 'root', + service_user => 'root', + service_group => 'root', + } +}