From 0e447c50249588970ef59433df2589e10f87abde Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Fri, 12 Dec 2014 22:01:35 +0100 Subject: [PATCH 1/1] Initial import. --- .fixtures.yml | 5 +++++ .gitignore | 7 +++++++ .rspec | 2 ++ .travis.yml | 31 +++++++++++++++++++++++++++++++ Gemfile | 18 ++++++++++++++++++ Guardfile | 5 +++++ Modulefile | 10 ++++++++++ Rakefile | 41 +++++++++++++++++++++++++++++++++++++++++ files/README | 1 + manifests/config.pp | 26 ++++++++++++++++++++++++++ manifests/init.pp | 8 ++++++++ manifests/install.pp | 9 +++++++++ manifests/params.pp | 24 ++++++++++++++++++++++++ metadata.json | 16 ++++++++++++++++ 14 files changed, 203 insertions(+) create mode 100644 .fixtures.yml create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 .travis.yml create mode 100644 Gemfile create mode 100644 Guardfile create mode 100644 Modulefile create mode 100644 Rakefile create mode 100644 files/README create mode 100644 manifests/config.pp create mode 100644 manifests/init.pp create mode 100644 manifests/install.pp create mode 100644 manifests/params.pp create mode 100644 metadata.json diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..9aef907 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,5 @@ +fixtures: + repositories: + stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" + symlinks: + hadoop: "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..641e153 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.*.sw? +pkg +spec/fixtures +.rspec_system +.vagrant +.bundle +vendor diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..8c18f1a --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--format documentation +--color diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..21b30f4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +--- +language: ruby +bundler_args: --without development +before_install: rm Gemfile.lock || true +rvm: + - 1.8.7 + - 1.9.3 + - 2.0.0 + - 2.1.0 +script: bundle exec rake test +env: + - PUPPET_VERSION="~> 2.7.0" + - PUPPET_VERSION="~> 3.2.0" STRICT_VARIABLES=yes + - PUPPET_VERSION="~> 3.3.0" STRICT_VARIABLES=yes + - PUPPET_VERSION="~> 3.4.0" STRICT_VARIABLES=yes + - PUPPET_VERSION="~> 3.5.0" STRICT_VARIABLES=yes + - PUPPET_VERSION="~> 3.6.0" STRICT_VARIABLES=yes +matrix: + exclude: + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.0.0 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 2.7.0" + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 3.2.0" STRICT_VARIABLES=yes + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 3.3.0" STRICT_VARIABLES=yes + - rvm: 2.1.0 + env: PUPPET_VERSION="~> 3.4.0" STRICT_VARIABLES=yes diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ec0ff8c --- /dev/null +++ b/Gemfile @@ -0,0 +1,18 @@ +source "https://rubygems.org" + +group :test do + gem "rake" + gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.7.0' + gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' + gem "puppetlabs_spec_helper" +end + +group :development do + gem "travis" + gem "travis-lint" + gem "beaker" + gem "beaker-rspec" + gem "vagrant-wrapper" + gem "puppet-blacksmith" + gem "guard-rake" +end diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..fd50602 --- /dev/null +++ b/Guardfile @@ -0,0 +1,5 @@ +notification :off + +guard 'rake', :task => 'test' do + watch(%r{^manifests\/(.+)\.pp$}) +end diff --git a/Modulefile b/Modulefile new file mode 100644 index 0000000..1cafc7c --- /dev/null +++ b/Modulefile @@ -0,0 +1,10 @@ +name 'meta-size_hadoop' +version '0.1.0' +source 'mailto://valtri@civ.zcu.cz' +author 'CESNET' +license 'Public Domain' +summary 'Hadoop Site-Specific Stuff' +description 'Site-specific setup for Hadoop Cluster' +project_page 'https://github.com/CESNET/' + +dependency 'puppetlabs/stdlib' diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ecf3b90 --- /dev/null +++ b/Rakefile @@ -0,0 +1,41 @@ +require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' + +# These two gems aren't always present, for instance +# on Travis with --without development +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError +end + +PuppetLint.configuration.relative = true +PuppetLint.configuration.send("disable_80chars") +PuppetLint.configuration.log_format = "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" +PuppetLint.configuration.fail_on_warnings = true + +# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. +# http://puppet-lint.com/checks/class_parameter_defaults/ +PuppetLint.configuration.send('disable_class_parameter_defaults') +# http://puppet-lint.com/checks/class_inherits_from_params_class/ +PuppetLint.configuration.send('disable_class_inherits_from_params_class') + +exclude_paths = [ + "pkg/**/*", + "vendor/**/*", + "spec/**/*", +] +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end + +desc "Run syntax, lint, and spec tests." +task :test => [ + :syntax, + :lint, + :spec, +] diff --git a/files/README b/files/README new file mode 100644 index 0000000..8d1052e --- /dev/null +++ b/files/README @@ -0,0 +1 @@ +Put here service keytabs into HOSTNAME/ subdirectories. diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 0000000..a1c283e --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,26 @@ +class site_hadoop::config { + if $site_hadoop::mc_setup { + file { '/etc/profile.d/mc.csh': + ensure => link, + target => "${site_hadoop::mc_setup}.csh", + } + file { '/etc/profile.d/mc.sh': + ensure => link, + target => "${site_hadoop::mc_setup}.sh", + } + } + + if $::osfamily == 'Debian' { + exec { 'key-cloudera': + command => 'apt-key adv --fetch-key http://archive.cloudera.com/cdh5/debian/wheezy/amd64/cdh/archive.key', + path => $site_hadoop::path, + creates => '/etc/apt/sources.list.d/cloudera.list', + } + -> + exec { 'wget-cloudera': + command => 'wget -P /etc/apt/sources.list.d/ http://archive.cloudera.com/cdh5/debian/wheezy/amd64/cdh/cloudera.list', + path => $site_hadoop::path, + creates => '/etc/apt/sources.list.d/cloudera.list', + } + } +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..995f530 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,8 @@ +class site_hadoop inherits site_hadoop::params { + include 'site_hadoop::install' + include 'site_hadoop::config' + + Class['site_hadoop::install'] -> + Class['site_hadoop::config'] -> + Class['site_hadoop'] +} diff --git a/manifests/install.pp b/manifests/install.pp new file mode 100644 index 0000000..c928615 --- /dev/null +++ b/manifests/install.pp @@ -0,0 +1,9 @@ +class site_hadoop::install { + include stdlib + + ensure_packages($site_hadoop::packages) + + if $site_hadoop::java_packages { + ensure_packages($site_hadoop::java_packages) + } +} diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..cc2fb9d --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,24 @@ +class site_hadoop::params { + case $::osfamily { + 'Debian': { + case $::lsbdistcodename { + 'lenny', 'squeeze', 'lucid', 'natty': { + $java_packages = ['openjdk-6-jre-headless'] + } + 'wheezy', 'jessie', 'precise','quantal','raring','saucy', 'trusty': { + $java_packages = ['openjdk-7-jre-headless'] + } + } + } + } + + $packages = $::osfamily ? { + debian => ['acpid', 'heimdal-clients', 'less', 'mc', 'puppet', 'vim', 'wget'], + redhat => ['acpid', 'krb5-workstation', 'less', 'mc', 'puppet', 'vim-enhanced', 'wget'], + } + $mc_setup = $::osfamily ? { + debian => '/usr/lib/mc/mc', + } + + $path = '/sbin:/usr/sbin:/bin:/usr/bin' +} diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..72dfca5 --- /dev/null +++ b/metadata.json @@ -0,0 +1,16 @@ +{ + "name": "meta-site_hadoop", + "version": "0.1.0", + "author": "CESNET", + "summary": "Hadoop Site-Specific Stuff", + "license": "Public Domain", + "source": "mailto://valtri@civ.zcu.cz", + "project_page": "https://github.com/CESNET/", + "issues_url": "mailto://valtri@civ.zcu.cz", + "dependencies": [ + { + "name": "puppetlabs-stdlib", + "version_range": ">= 1.0.0" + } + ] +} -- 1.8.2.3