From 099b308c4ded6d99d735b7916f8947d909e50818 Mon Sep 17 00:00:00 2001 From: Nick Chappell Date: Sat, 24 Jan 2015 20:07:13 -0800 Subject: [PATCH] Merged in support for Red Hat operating systems. Merged in from: https://github.com/Icinga/puppet-icinga2/pull/83/ --- README.md | 9 +++++++++ manifests/params.pp | 27 ++++++++++++++++++--------- manifests/server.pp | 2 +- manifests/server/install.pp | 7 +++---- metadata.json | 8 ++++++++ 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 78b36e7..82f50ca 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,15 @@ For Ubuntu systems, this module requires the [Puppet Labs apt module](https://gi On EL-based systems (CentOS, Red Hat Enterprise Linux, Fedora, etc.), the [EPEL package repository](https://fedoraproject.org/wiki/EPEL) is required. You can also use the [icinga2::nrpe class](#nrpe-usage) to set up NRPE on CentOS 5. It is discouraged to set up Icinga2 Server on this old of a distribution. You are encouraged to use at least CentOS 6 or higher. +####Note for RedHat + +If you are using RedHat Satellite server, set +
+   $manage_repos = false
+
+ +in `icinga2::server` class and make sure, you have a channel set up with the contents of the icinga2 repository and the needed packages from EPEL. If you leave it at true, the EPEL repository will be used directly. + If you would like to use the `icinga2::object` defined types as [exported resources](https://docs.puppetlabs.com/guides/exported_resources.html), you'll need to have your Puppet master set up with PuppetDB. See the Puppet Labs documentation for more info: [Docs: PuppetDB](https://docs.puppetlabs.com/puppetdb/) ###Server requirements diff --git a/manifests/params.pp b/manifests/params.pp index cd674ba..862a2ba 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -18,14 +18,20 @@ class icinga2::params { ################## # Icinga 2 common package parameters case $::operatingsystem { - #CentOS systems: + #CentOS or RedHat systems: 'CentOS', 'RedHat': { + #Pick the right package provider: + $package_provider = 'yum' + } + + #RedHat systems: + 'RedHat': { #Pick the right package provider: $package_provider = 'yum' } - #Ubuntu systems: - 'Ubuntu': { + #Ubuntu systems: + 'Ubuntu': { #Pick the right package provider: $package_provider = 'apt' } @@ -95,9 +101,9 @@ class icinga2::params { } } - #Ubuntu systems: - 'Ubuntu': { - case $::operatingsystemrelease { + #Ubuntu systems: + 'Ubuntu': { + case $::operatingsystemrelease { #Ubuntu 12.04 doesn't have nagios-plugins-common or nagios-plugins-contrib packages available... '12.04': { $icinga2_server_package = 'icinga2' @@ -143,7 +149,7 @@ class icinga2::params { # Icinga 2 server config parameters case $::operatingsystem { - #CentOS systems: + #CentOS or RedHat systems: 'CentOS', 'RedHat': { #Settings for /etc/icinga2/: $etc_icinga2_owner = 'icinga' @@ -322,6 +328,7 @@ class icinga2::params { $nrpe_user = 'nrpe' $nrpe_group = 'nrpe' } + #File and template variable names for Ubuntu systems: 'Ubuntu': { $nrpe_config_basedir = '/etc/nagios' @@ -331,6 +338,7 @@ class icinga2::params { $nrpe_user = 'nagios' $nrpe_group = 'nagios' } + #File and template variable names for Ubuntu systems: 'Debian': { $nrpe_config_basedir = '/etc/nagios' @@ -340,14 +348,15 @@ class icinga2::params { $nrpe_user = 'nagios' $nrpe_group = 'nagios' } - #Fail if we're on any other OS: + + #Fail if we're on any other OS: default: { fail("${::operatingsystem} is not supported!") } } ################## # Icinga 2 client package parameters case $::operatingsystem { - #CentOS systems: + #CentOS or RedHat systems: 'CentOS', 'RedHat': { case $::operatingsystemmajrelease { '5': { diff --git a/manifests/server.pp b/manifests/server.pp index 32d9932..b441e4b 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -44,7 +44,7 @@ class icinga2::server ( #Pick set the right path where we can find the DB schema based on the OS... case $::operatingsystem { - 'CentOS': { + 'CentOS','RedHat': { #...and database that the user picks case $server_db_type { 'mysql': { $server_db_schema_path = '/usr/share/icinga2-ido-mysql/schema/mysql.sql' } diff --git a/manifests/server/install.pp b/manifests/server/install.pp index 851926b..507d6e3 100644 --- a/manifests/server/install.pp +++ b/manifests/server/install.pp @@ -32,9 +32,8 @@ class icinga2::server::install::repos inherits icinga2::server { if $manage_repos == true { case $::operatingsystem { - #CentOS systems: + #CentOS or RedHat systems: 'CentOS', 'RedHat': { - #Add the official Icinga Yum repository: http://packages.icinga.org/epel/ yumrepo { 'icinga2_yum_repo': baseurl => "http://packages.icinga.org/epel/${::operatingsystemmajrelease}/release/", @@ -45,8 +44,8 @@ class icinga2::server::install::repos inherits icinga2::server { } } - #Ubuntu systems: - 'Ubuntu': { + #Ubuntu systems: + 'Ubuntu': { #Include the apt module's base class so we can... include apt #...use the apt module to add the Icinga 2 PPA from launchpad.net: diff --git a/metadata.json b/metadata.json index 676dd43..871534d 100644 --- a/metadata.json +++ b/metadata.json @@ -16,6 +16,14 @@ "7" ] }, + { + "operatingsystem": "RedHat", + "operatingsystemmajrelease": [ + "5", + "6", + "7" + ] + }, { "operatingsystem": "Debian", "operatingsystemmajrelease": [