Merge branch 'feature/icinga2_package_install' into develop
This commit is contained in:
commit
0cd1b80733
2 changed files with 82 additions and 15 deletions
|
@ -15,12 +15,12 @@ class icinga2::params {
|
|||
|
||||
#Whether to manage the package repositories
|
||||
$manage_repos = 'true'
|
||||
|
||||
$server_db_type = 'pgsql'
|
||||
|
||||
##############################
|
||||
# Icinga 2 server package parameters
|
||||
|
||||
$server_db_type = 'pgsql'
|
||||
|
||||
#Pick the right package and package provider parameters based on the OS:
|
||||
case $operatingsystem {
|
||||
#Red Hat/CentOS systems:
|
||||
'RedHat', 'CentOS': {
|
||||
|
@ -28,6 +28,12 @@ class icinga2::params {
|
|||
$package_provider = 'yum'
|
||||
#Icinga 2 server package
|
||||
$icinga2_server_package = 'icinga2'
|
||||
|
||||
#Pick set the right path where we can find the DB schema
|
||||
case $server_db_type {
|
||||
'mysql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-mysql-2.0.0/schema/mysql.sql' }
|
||||
'pgsql': { $server_db_schema_path = '/usr/share/doc/icinga2-ido-pgsql-2.0.0/schema/pgsql.sql' }
|
||||
}
|
||||
}
|
||||
|
||||
#Debian/Ubuntu systems:
|
||||
|
@ -37,18 +43,10 @@ class icinga2::params {
|
|||
#Icinga 2 server package
|
||||
$icinga2_server_package = 'icinga2'
|
||||
|
||||
#Set some package repo variables based on the Ubuntu release:
|
||||
case $operatingsystemrelease {
|
||||
#For Ubuntu 12.04 Precise Pangolin: http://releases.ubuntu.com/12.04/
|
||||
'12.04': {
|
||||
|
||||
}
|
||||
#For Ubuntu 14.04 Trusty Tahr: http://releases.ubuntu.com/14.04/
|
||||
'14.04': {
|
||||
|
||||
}
|
||||
#Fail if we are on any other Ubuntu release:
|
||||
default: { fail("${operatingsystem} ${operatingsystemrelease} is not a supported Ubuntu release!") }
|
||||
#Pick set the right path where we can find the DB schema
|
||||
case $server_db_type {
|
||||
'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' }
|
||||
'pgsql': { $server_db_schema_path = '/usr/share/icinga2-ido-pgsql/schema/pgsql.sql' }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,16 +30,85 @@ class icinga2::server::install::repos inherits icinga2::server {
|
|||
|
||||
include icinga2::params
|
||||
|
||||
case $operatingsystem {
|
||||
#Red Hat/CentOS systems:
|
||||
'RedHat', 'CentOS': {
|
||||
|
||||
#Add the official Icinga Yum repository: http://packages.icinga.org/epel/
|
||||
yumrepo { 'icinga2_yum_repo':
|
||||
baseurl => "http://packages.icinga.org/epel/${operatingsystemmajrelease}/release/",
|
||||
descr => "Icinga 2 Yum repository",
|
||||
enabled => 1,
|
||||
gpgcheck => 1,
|
||||
gpgkey => 'http://packages.icinga.org/icinga.key'
|
||||
}
|
||||
}
|
||||
|
||||
#Debian/Ubuntu systems:
|
||||
/^(Debian|Ubuntu)$/: {
|
||||
#Add the Icinga 2 snapshots apt repo for Ubuntu Saucy Salamander:
|
||||
apt::source { "icinga2_ubuntu_${lsbdistcodename}_release_apt":
|
||||
location => 'http://packages.icinga.org/ubuntu',
|
||||
release => "icinga-${lsbdistcodename}",
|
||||
repos => 'main',
|
||||
required_packages => 'debian-keyring debian-archive-keyring',
|
||||
key => '34410682',
|
||||
key_source => 'http://packages.icinga.org/icinga.key',
|
||||
include_src => true
|
||||
}
|
||||
}
|
||||
|
||||
#Fail if we're on any other OS:
|
||||
default: { fail("${operatingsystem} is not supported!") }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Install packages for Icinga 2:
|
||||
class icinga2::server::install::packages inherits icinga2::server {
|
||||
|
||||
include icinga2::params
|
||||
|
||||
#Install the Icinga 2 package
|
||||
package {$icinga2_server_package:
|
||||
ensure => installed,
|
||||
provider => $package_provider,
|
||||
}
|
||||
|
||||
#Pick the right DB lib package name based on the database type the user selected:
|
||||
case $icinga2::server::server_db_type {
|
||||
#MySQL:
|
||||
'mysql': { $icinga2_server_db_connector_package = 'icinga2-ido-mysql'}
|
||||
#Postgres:
|
||||
'pgsql': { $icinga2_server_db_connector_package = 'icinga2-ido-pgsql'}
|
||||
default: { fail("${icinga2::params::server_db_type} is not a supported database! Please specify either 'mysql' for MySQL or 'pgsql' for Postgres.") }
|
||||
}
|
||||
|
||||
#Install the IDO database connector package. See:
|
||||
#http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/getting-started#configuring-db-ido
|
||||
package {$icinga2_server_db_connector_package:
|
||||
ensure => installed,
|
||||
provider => $package_provider,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#This class contains exec resources
|
||||
class icinga2::server::install::execs inherits icinga2::server {
|
||||
|
||||
include icinga2::params
|
||||
|
||||
case $icinga::params::server_db_type {
|
||||
#Schema loading for MySQL:
|
||||
'mysql': {
|
||||
|
||||
}
|
||||
#Schema loading for Postgres:
|
||||
'pgsql': {
|
||||
|
||||
}
|
||||
|
||||
default: { fail("${icinga2::params::server_db_type} is not supported!") }
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue