adding changes of analytics box

Change-Id: Ic76fd1072378879b82c8f60aa621bd694d13d447
This commit is contained in:
sandip-calsoft 2016-08-05 07:12:08 +00:00
parent c5e88f96f6
commit e41ae83995
4 changed files with 185 additions and 0 deletions

View File

@ -21,6 +21,11 @@ mod 'puppetlabs/firewall'
mod 'deric/zookeeper'
mod 'locp/cassandra'
mod 'puppetlabs/concat'
mod 'TubeMogul/curator'
mod 'elasticsearch/elasticsearch'
mod 'elasticsearch/logstash'
mod 'electrical/file_concat'
mod 'midonet_openstack',
:git => 'https://github.com/midonet/puppet-midonet_openstack',

91
manifests/analytics.pp Normal file
View File

@ -0,0 +1,91 @@
# == Class: midonet::analytics
#
# Installs midonet analytics packages
#
# === Parameters
#
# [*is_mem*]
# Boolean variable - If true puppet will install MEM specific services
# Default: false
#
# [*manage_repo*]
# Boolean variable - If true puppet will install repositories on given node
# Default: false
#
# [*mem_username*]
# Username which will have access to Midokura repositories
# Default: undef
#
# [*mem_password*]
# Password for User which will be used to access the Midokura repositories
# Default: undef
#
#
# Please note that Keystone port is not mandatory and defaulted to 35537.
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2015 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::analytics (
$is_mem = false,
$manage_repo = false,
$mem_username = undef,
$mem_password = undef,
) {
class { 'logstash':
manage_repo => true,
java_install => true,
repo_version => '1.5',
}
class { 'elasticsearch':
manage_repo => true,
repo_version => '1.7',
}
class { 'curator':
version => '3.5',
}
if $is_mem {
if $manage_repo == true {
if !defined(Class['midonet::repository']) {
class {'midonet::repository':
is_mem => $is_mem,
midonet_version => undef,
midonet_stage => undef,
openstack_release => undef,
mem_version => undef,
mem_username => $mem_username,
mem_password => $mem_password,
}
}
}
class { 'midonet::analytics::services':
require => Class['midonet::repository'],
}
}
else {
notice('Skipping installation of midonet analytics services')
}
}

View File

@ -0,0 +1,57 @@
# == Class: midonet::analytics::services
# Check out the midonet::analytics class for a full understanding of
# how to use the midonet::analytics resource
#
# Installs midonet-analytics and midonet-tools package
#
# === Parameters
#
# [*analytics_package_name*]
# For making mn-conf command available in the Analytics Node
# Default: midonet-analytics
#
# [*midonet-tools*]
# For making mn-conf command available in the Analytics Node
# Default: midonet-tools
#
# === Authors
#
# Midonet (http://midonet.org)
#
# === Copyright
#
# Copyright (c) 2016 Midokura SARL, All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class midonet::analytics::services (
$analytics_package_name = 'midonet-analytics',
$tools_package_name = 'midonet-tools',
) {
include midonet::repository
include ::midonet_openstack::profile::midojava::midojava
package { $tools_package_name:
ensure => present,
name => $tools_package_name,
require => Class['midonet_openstack::profile::midojava::midojava'],
}
package { $analytics_package_name:
ensure => present,
name => $analytics_package_name,
require => Class['midonet_openstack::profile::midojava::midojava'],
}
}

View File

@ -0,0 +1,32 @@
require 'spec_helper_acceptance'
describe 'midonet::analytics class' do
context 'with mandatory parameters (default params not overwritten)' do
# Using puppet_apply as a helper
it 'should install the midonet analytics without any errors' do
pp = <<-EOS
class { 'midonet::analytics':
is_mem => false,
manage_repo => false,
mem_username => undef,
mem_password => undef,
}
EOS
# Run it twice and test for idempotency
expect(apply_manifest(pp).exit_code).to_not eq(1)
expect(apply_manifest(pp).exit_code).to eq(0)
end
describe package('logstash') do
it { should be_installed }
end
describe package('elasticsearch') do
it { should be_installed }
end
end
context
end