Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
[Fix] Final adjustments after a clean run of the Server
Browse files Browse the repository at this point in the history
  • Loading branch information
Techcadia committed May 19, 2017
1 parent 91f9809 commit ae352cb
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 47 deletions.
11 changes: 8 additions & 3 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

default['icinga2']['version'] = value_for_platform(
%w(centos redhat fedora amazon) => { 'default' => '2.6.3-1' },
%w(debian ubuntu raspbian) => { 'default' => '2.6.3-1' }
%w(debian ubuntu raspbian) => { 'default' => '2.6.3-1' },
%w(windows) => { 'default' => '2.6.3' }
)

default['icinga2']['enable_env_pki'] = false
Expand Down Expand Up @@ -31,7 +32,11 @@
default['icinga2']['add_inet_custom_vars'] = false

# itl defaults
default['icinga2']['include_itl'] = %w(itl plugins)
default['icinga2']['include_itl'] = if node['platform'] == 'windows'
%w(itl plugins plugins-contrib manubulon)
else
%w(itl plugins)
end

# includes yum-epel cookbook to setup yum epel repository
default['icinga2']['setup_epel'] = true
Expand Down Expand Up @@ -105,7 +110,7 @@
default['icinga2']['user'] = 'NT AUTHORITY\\NETWORK SERVICE'
default['icinga2']['group'] = 'NT AUTHORITY\\NETWORK SERVICE'
default['icinga2']['cmdgroup'] = 'NT AUTHORITY\\NETWORK SERVICE'
default['icinga2']['plugins_dir'] = 'C:/Program Files/ICINGA2/share/icinga2/include/plugins-contrib'
default['icinga2']['plugins_dir'] = 'C:/Program Files/ICINGA2/sbin'
end

default['icinga2']['custom_plugins_dir'] = if node['platform'] == 'windows'
Expand Down
5 changes: 5 additions & 0 deletions attributes/server_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
default['icinga2']['constants']['NodeName'] = node['fqdn']
default['icinga2']['constants']['PluginDir'] = node['icinga2']['plugins_dir']
default['icinga2']['constants']['ManubulonPluginDir'] = node['icinga2']['plugins_dir']

if platform?('windows')
default['icinga2']['constants']['PluginContribDir'] = node['icinga2']['plugins_dir']
end

default['icinga2']['constants']['TicketSalt'] = 'ed25aed394c4bf7d236b347bb67df466'
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
depends 'apache2', '~> 3.2.2'
depends 'ulimit', '~> 0.4.0'
depends 'pnp4nagios', '~> 0.2.8'
depends 'chocolatey', '~> 1.0.3'

%w(redhat centos amazon ubuntu debian).each do |os|
%w(redhat centos amazon ubuntu debian windows).each do |os|
supports os
end
31 changes: 16 additions & 15 deletions recipes/client_os_packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
#

# install packages for icinga2 / classicui2 / web2
unless platform?('windows')
case node['platform_family']
when 'debian'
# package libjpeg62-dev conflicts with libgd2-xpm-dev
# perhaps can be removed.
os_packages = %w(g++ mailutils build-essential)
include_recipe 'apt'
when 'rhel'
os_packages = %w(gcc gcc-c++ glibc glibc-common mailx)
# yum epel repository is required for php-pecl-imagick
include_recipe 'yum-epel' if node['platform'] != 'amazon' && node['icinga2']['setup_epel']
end

case node['platform_family']
when 'debian'
# package libjpeg62-dev conflicts with libgd2-xpm-dev
# perhaps can be removed.
os_packages = %w(g++ mailutils build-essential)
include_recipe 'apt'
when 'rhel'
os_packages = %w(gcc gcc-c++ glibc glibc-common mailx)
# yum epel repository is required for php-pecl-imagick
include_recipe 'yum-epel' if node['platform'] != 'amazon' && node['icinga2']['setup_epel']
end

# dependencies
os_packages.each do |p|
package p
# dependencies
os_packages.each do |p|
package p
end
end
60 changes: 33 additions & 27 deletions recipes/core_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,40 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

case node['platform_family']
when 'debian'
# apt repository configuration
apt_repository 'icinga2' do
uri node['icinga2']['apt']['uri']
distribution node['icinga2']['apt']['distribution']
components node['icinga2']['apt']['components']
keyserver node['icinga2']['apt']['keyserver'] unless node['icinga2']['apt']['keyserver'].nil?
key node['icinga2']['apt']['key']
deb_src node['icinga2']['apt']['deb_src']
action node['icinga2']['apt']['action']
if platform?('windows')
chocolatey_package 'icinga2' do
version node['icinga2']['version']
action :upgrade
end
when 'rhel'
# yum repository configuration
yum_repository 'icinga2' do
description node['icinga2']['yum']['description']
baseurl node['icinga2']['yum']['baseurl']
mirrorlist node['icinga2']['yum']['mirrorlist'] if node['icinga2']['yum']['mirrorlist']
gpgcheck node['icinga2']['yum']['gpgcheck']
gpgkey node['icinga2']['yum']['gpgkey']
enabled node['icinga2']['yum']['enabled']
action node['icinga2']['yum']['action']
else
case node['platform_family']
when 'debian'
# apt repository configuration
apt_repository 'icinga2' do
uri node['icinga2']['apt']['uri']
distribution node['icinga2']['apt']['distribution']
components node['icinga2']['apt']['components']
keyserver node['icinga2']['apt']['keyserver'] unless node['icinga2']['apt']['keyserver'].nil?
key node['icinga2']['apt']['key']
deb_src node['icinga2']['apt']['deb_src']
action node['icinga2']['apt']['action']
end
when 'rhel'
# yum repository configuration
yum_repository 'icinga2' do
description node['icinga2']['yum']['description']
baseurl node['icinga2']['yum']['baseurl']
mirrorlist node['icinga2']['yum']['mirrorlist'] if node['icinga2']['yum']['mirrorlist']
gpgcheck node['icinga2']['yum']['gpgcheck']
gpgkey node['icinga2']['yum']['gpgkey']
enabled node['icinga2']['yum']['enabled']
action node['icinga2']['yum']['action']
end
end
end

# install icinga2 core packages
package 'icinga2' do
version node['icinga2']['version'] + node['icinga2']['icinga2_version_suffix'] unless node['icinga2']['ignore_version']
notifies :restart, 'service[icinga2]', :delayed
# install icinga2 core packages
package 'icinga2' do
version node['icinga2']['version'] + node['icinga2']['icinga2_version_suffix'] unless node['icinga2']['ignore_version']
notifies :restart, 'service[icinga2]', :delayed
end
end
2 changes: 1 addition & 1 deletion recipes/service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

service 'icinga2' do
service_name node['icinga2']['service_name']
supports :status => true, :reload => true, :restart => true
supports :status => true, :reload => platform?('windows') ? false : true, :restart => true
action [:enable]
end

Expand Down
12 changes: 12 additions & 0 deletions templates/default/icinga2.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ include "constants.conf"
include <<%= itl -%>>
<% end -%>

<% if node['platform'] == 'windows' -%>
/**
* This includes the Icinga 2 Windows plugins.
*/
include <windows-plugins>

/**
* This includes the NSClient++ check commands.
*/
include <nscp>
<% end -%>

/**
* The features-available directory contains a number of configuration
* files for features which can be enabled and disabled using the
Expand Down

0 comments on commit ae352cb

Please sign in to comment.