You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ja...@apache.org on 2014/12/18 04:40:57 UTC
bigtop git commit: BIGTOP-1578. Refactor vagrant-puppet provisioner
to have its configurations all come from yaml
Repository: bigtop
Updated Branches:
refs/heads/master 7e008b781 -> 648fed29c
BIGTOP-1578. Refactor vagrant-puppet provisioner to have its configurations all come from yaml
Signed-off-by: jayunit100 <ja...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/648fed29
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/648fed29
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/648fed29
Branch: refs/heads/master
Commit: 648fed29cfd44e4b4bb67b8ee60bbbfadbb8f9f9
Parents: 7e008b7
Author: evans_ye <in...@gmail.com>
Authored: Wed Dec 17 21:54:48 2014 +0800
Committer: jayunit100 <ja...@apache.org>
Committed: Wed Dec 17 22:39:14 2014 -0500
----------------------------------------------------------------------
bigtop-deploy/vm/utils/setup-env.sh | 1 +
bigtop-deploy/vm/vagrant-puppet/Vagrantfile | 67 ++++++++++++--------
bigtop-deploy/vm/vagrant-puppet/provision.sh | 34 ----------
.../vm/vagrant-puppet/vagrantconfig.yaml | 1 +
4 files changed, 43 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bigtop/blob/648fed29/bigtop-deploy/vm/utils/setup-env.sh
----------------------------------------------------------------------
diff --git a/bigtop-deploy/vm/utils/setup-env.sh b/bigtop-deploy/vm/utils/setup-env.sh
index d211fc9..97a1922 100755
--- a/bigtop-deploy/vm/utils/setup-env.sh
+++ b/bigtop-deploy/vm/utils/setup-env.sh
@@ -18,6 +18,7 @@
# Install puppet agent
yum -y install http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm
yum -y install puppet
+cd /etc/puppet/modules && puppet module install puppetlabs/stdlib
mkdir -p /data/{1,2}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/648fed29/bigtop-deploy/vm/vagrant-puppet/Vagrantfile
----------------------------------------------------------------------
diff --git a/bigtop-deploy/vm/vagrant-puppet/Vagrantfile b/bigtop-deploy/vm/vagrant-puppet/Vagrantfile
index 3fe1f8b..2f31055 100755
--- a/bigtop-deploy/vm/vagrant-puppet/Vagrantfile
+++ b/bigtop-deploy/vm/vagrant-puppet/Vagrantfile
@@ -21,16 +21,41 @@ require "yaml"
_config = YAML.load(File.open(File.join(File.dirname(__FILE__), "vagrantconfig.yaml"), File::RDONLY).read)
CONF = _config
+# Repository
+# Example for testing a Release candidate.
+repo = CONF['repo']
+# repo = "http://bigtop.s3.amazonaws.com/releases/0.7.0/redhat/6/x86_64"
+
+# number of instances
+num_instances = CONF['num_instances']
+
+# hadoop ecosystem components
+components = CONF['components']
+
+# Whether to run smoke tests
+run_smoke_tests = CONF['run_smoke_tests']
+
+# master node hostname
+bigtop_master = "bigtop1.vagrant"
+
+$script = <<SCRIPT
+service iptables stop
+chkconfig iptables off
+cat /dev/null > /etc/hosts
+echo "Bigtop yum repo = #{repo}"
+# Prepare puppet configuration file
+mkdir /vagrant/config
+cat > /vagrant/config/site.csv << EOF
+hadoop_head_node,#{bigtop_master}
+hadoop_storage_dirs,/data/1,/data/2
+bigtop_yumrepo_uri,#{repo}
+jdk_package_name,java-1.7.0-openjdk-devel.x86_64
+components,#{components}
+EOF
+SCRIPT
+
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- # Repository
- # Example for testing a Release candidate.
- repo = CONF['repo']
- # repo = "http://bigtop.s3.amazonaws.com/releases/0.7.0/redhat/6/x86_64"
-
- # number of instances
- num_instances = CONF['num_instances']
-
# manage /etc/hosts by hostmanager plugin(https://github.com/smdahlen/vagrant-hostmanager)
# use vagrant-cachier to cache packages at local(https://github.com/fgrehm/vagrant-cachier)
config.hostmanager.enabled = true
@@ -40,9 +65,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.cache.scope = :box
end
- # declare the variable first, will be override in following loop
- bigtop_master = ""
-
# nodes definition
(1..num_instances).each do |i|
config.vm.define "bigtop#{i}" do |bigtop|
@@ -50,9 +72,6 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
bigtop.vm.box = CONF['box']
bigtop_hostname="bigtop#{i}.vagrant"
bigtop_ip="10.10.10.1#{i}"
- if "#{i}" == "1"
- bigtop_master = bigtop_hostname
- end
bigtop.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", CONF['memory_size']]
@@ -78,13 +97,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# carry on w/ installation
bigtop.vm.provision "shell", path: "../utils/setup-env.sh"
-
- # shell provisioner to setup basic vm environment
- bigtop.vm.provision :shell do |shell|
- shell.path = "provision.sh"
- shell.args = [ bigtop_master , repo, CONF["components"]]
- end
-
+ bigtop.vm.provision "shell", inline: $script
bigtop.vm.provision :hostmanager
# deploy Apache Hadoop and it's ecosystem
@@ -95,11 +108,13 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
puppet.options = "--debug --confdir=/vagrant"
end
- if i==num_instances then
- puts "creating provisioner directive for running tests"
- bigtop.vm.provision "shell", path: "../utils/smoke-tests.sh"
- else
- puts "Not creating provisioner directive for tests yet... only on vm #{i} of #{num_instances}"
+ if run_smoke_tests then
+ if i==num_instances then
+ puts "creating provisioner directive for running tests"
+ bigtop.vm.provision "shell", path: "../utils/smoke-tests.sh"
+ else
+ puts "Not creating provisioner directive for tests yet... only on vm #{i} of #{num_instances}"
+ end
end
end
http://git-wip-us.apache.org/repos/asf/bigtop/blob/648fed29/bigtop-deploy/vm/vagrant-puppet/provision.sh
----------------------------------------------------------------------
diff --git a/bigtop-deploy/vm/vagrant-puppet/provision.sh b/bigtop-deploy/vm/vagrant-puppet/provision.sh
deleted file mode 100755
index bf8672d..0000000
--- a/bigtop-deploy/vm/vagrant-puppet/provision.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-
-service iptables stop
-chkconfig iptables off
-cat /dev/null > /etc/hosts
-
-echo "Bigtop yum repo = $2"
-
-# Prepare puppet configuration file
-cd /etc/puppet/modules && puppet module install puppetlabs/stdlib
-
-mkdir /vagrant/config
-cat > /vagrant/config/site.csv << EOF
-hadoop_head_node,$1
-hadoop_storage_dirs,/data/1,/data/2
-bigtop_yumrepo_uri,$2
-jdk_package_name,java-1.7.0-openjdk-devel.x86_64
-components,$3
-EOF
http://git-wip-us.apache.org/repos/asf/bigtop/blob/648fed29/bigtop-deploy/vm/vagrant-puppet/vagrantconfig.yaml
----------------------------------------------------------------------
diff --git a/bigtop-deploy/vm/vagrant-puppet/vagrantconfig.yaml b/bigtop-deploy/vm/vagrant-puppet/vagrantconfig.yaml
index 1c0f87d..7f79acc 100644
--- a/bigtop-deploy/vm/vagrant-puppet/vagrantconfig.yaml
+++ b/bigtop-deploy/vm/vagrant-puppet/vagrantconfig.yaml
@@ -5,3 +5,4 @@ repo: "http://bigtop01.cloudera.org:8080/view/Releases/job/Bigtop-0.8.0/label=ce
num_instances: 1
components: "hadoop,yarn"
enable_local_yum: false
+run_smoke_tests: false