Enabled: false
Style/SpaceBeforeFirstArg:
Enabled: false
+Style/SpaceInsideBlockBraces:
+ Enabled: false
+Style/SpaceInsidePercentLiteralDelimiters:
+ Enabled: false
Style/TrailingCommaInLiteral:
- EnforcedStyleForMultiline: comma
+ EnforcedStyleForMultiline: consistent_comma
Style/WordArray:
Enabled: false
-
+
#Style/AccessorMethodName:
# Enabled: false
#Style/MethodLength:
nagios-grid CHANGELOG
=====================
+0.1.3
+-----
+- adds the Debian 9 (stretch) support.
+- adds the Ubuntu 17.04 support.
+
0.1.2
-----
- adds the `check_mem.pl` plugin support.
source 'https://rubygems.org'
-#gem 'foodcritic'
+# with Chef DK
+gem 'stove'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'foodcritic'
+require 'stove/rake_task'
namespace :style do
desc 'Run Ruby style checks'
- RuboCop::RakeTask.new(:ruby)
+ RuboCop::RakeTask.new(:ruby) do |t|
+ t.options = [
+ '--auto-gen-config', # creates .rubocop_todo.yml
+ ]
+ end
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
- tags: ['~FC001'],
}
end
end
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
+desc 'Publish cookbook'
+Stove::RakeTask.new(:publish) do |t|
+ t.stove_opts = [
+ # `--username` and `--key` are set in ~/.stove typically.
+ #'--username', 'somebody',
+ #'--key', '~/chef/chef.io.example.com/somebody.pem',
+ #'--endpoint', 'https://supermarket.io.example.com/api/v1', # default: supermarket.chef.io
+ #'--no-ssl-verify',
+ '--no-git',
+ '--log-level', 'info',
+ ]
+end
+
task default: ['style', 'spec']
--- /dev/null
+---
+# $ fly -t target sp -p nagios-grid-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
+resources:
+- name: src-git
+ type: git
+ source:
+ uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
+ branch: master
+ paths:
+ - cookbooks/((cookbook-name))
+- name: chefdk-cache
+ type: docker-image
+ source:
+ repository: chef/chefdk
+ tag: ((chefdk-version))
+ # ((param)) style: fly >= 3.2.0
+ registry_mirror: https://((registry-mirror-domain)) # e.g. https://registry.docker.example.com:5000
+ ca_certs:
+ - domain: ((registry-mirror-domain)) # e.g. registry.docker.example.com:5000
+ cert: ((docker-reg-ca-cert))
+
+jobs:
+- name: build-cookbook
+ plan:
+ - get: src-git
+ trigger: true
+ - get: chefdk-cache
+ - task: ci-build
+ image: chefdk-cache
+ config:
+ platform: linux
+
+ #image_resource:
+ # type: docker-image
+ # source:
+ # repository: chef/chefdk
+ # tag: ((chefdk-version))
+ # NG, setting disable
+ #registry_mirror: https://((registry-mirror-domain))
+ #ca_certs:
+ #- domain: ((registry-mirror-domain))
+ # cert: ((docker-reg-ca-cert))
+
+ inputs:
+ - name: src-git
+
+ run:
+ #dir: ./src-git/cookbooks/((cookbook-name))
+ #path: rake
+ path: /bin/bash
+ args:
+ - -c
+ - |
+ cd ./src-git/cookbooks/((cookbook-name))
+ bundle install
+ rake
--- /dev/null
+---
+cookbook-name: nagios-grid
+chefdk-version: 1.4.3
license 'Apache 2.0'
description 'Installs/Configures nagios-grid'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version '0.1.2'
+version '0.1.3'
source_url 'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
issues_url 'https://osdn.jp/projects/metasearch/ticket'
supports os
end
-# local cookbooks
-
-# external cookbooks
+chef_version '>= 12'
depends 'yum-epel'
# limitations under the License.
#
+platform = node['platform']
+platform_version = node['platform_version']
+
root_cfg_dir = nil
base_cfg_dir = nil
site_cfg_dir = nil
root_cfg_dir = '/etc/nagios3'
nagios_pkgs = [
# Note: PHP is not php5 but php7.0 in Ubuntu 16.04 or later
- 'nagios3',
'nagios-plugins',
'nagios-images',
]
- if node['nagios']['with_pnp4nagios'] && node['platform'] == 'debian'
- # this recipe does not support pnp4nagios on Ubuntu!
+
+ unless platform == 'debian' && platform_version >= '9.0'
+ nagios_pkgs += [
+ 'nagios3',
+ ]
+ end
+
+ if node['nagios']['with_pnp4nagios'] && platform == 'debian' && platform_version < '9.0'
+ # this recipe does not support pnp4nagios on Ubuntu and the latest Debian !
nagios_pkgs += [
# Debian and Ubuntu 15.10, 14.04, 12.04 only.
'pnp4nagios',
'pnp4nagios-web-config-nagios3',
]
end
+
if node['nagios']['web']['AuthType'] == 'Kerberos'
nagios_pkgs.push('libapache2-mod-auth-kerb')
end
+
nagios_service = 'nagios3'
httpd_service = 'apache2'
httpd_nagios_conf = "#{root_cfg_dir}/apache2.conf"
'nagios',
'nagios-plugins',
]
+
nagios_pkgs += \
%w(load users ping ssh ntp http disk swap procs file_age).map {|item|
"nagios-plugins-#{item}"
}
+
if node['nagios']['with_pnp4nagios']
include_recipe 'yum-epel'
nagios_pkgs += [
'pnp4nagios',
]
end
+
if node['nagios']['web']['AuthType'] == 'Kerberos'
nagios_pkgs.push('mod_auth_kerb')
end
+
nagios_service = 'nagios'
httpd_service = 'httpd'
httpd_nagios_conf = '/etc/httpd/conf.d/nagios.conf'
# limitations under the License.
#
-[
+platform = node['platform']
+platform_version = node['platform_version']
+
+pkgs = [
'nagios-nrpe-server',
'nagios-plugins',
'nagios-plugins-contrib', # for check_memory
- 'libnagios-plugin-perl', # for check_memory
-].each {|pkg|
+]
+
+if (platform == 'debian' && platform_version < '9.0') \
+ || (platform == 'ubuntu' && platform_version < '17.04')
+ pkgs += ['libnagios-plugin-perl'] # for check_memory
+end
+
+pkgs.each {|pkg|
resources(package: pkg) rescue package pkg do
action :install
end