mirror of https://github.com/apache/cloudstack.git
Merge in of cleanup work.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
b7181bb426
commit
b996aff418
|
|
@ -0,0 +1,2 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'vagrant', :git => 'https://github.com/chipchilders/vagrant'
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
# 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
|
||||
|
|
@ -19,33 +19,38 @@
|
|||
# under the License.
|
||||
|
||||
Vagrant::Config.run do |config|
|
||||
config.vm.box = "devcloud"
|
||||
# TODO: Get a URL to host the base image
|
||||
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
||||
config.vm.box = "devcloud"
|
||||
#config.vm.box = "devcloudbase-xen"
|
||||
#config.vm.box_url = "http://basho-cloudstack.s3.amazonaws.com/devcloud.box"
|
||||
|
||||
config.vm.guest = :xen
|
||||
config.ssh.username = "devcloud"
|
||||
|
||||
# Uncomment this line to enable the console for debugging the
|
||||
config.vm.host_name = "devcloud.local"
|
||||
# Uncomment this line to enable the console for debugging the
|
||||
# build process.
|
||||
# config.vm.boot_mode = :gui
|
||||
|
||||
# Setup port forwarding
|
||||
config.vm.forward_port 22, 2222
|
||||
config.vm.forward_port 22, 7222
|
||||
config.vm.forward_port 3306, 3306
|
||||
config.vm.forward_port 8080, 8080
|
||||
config.vm.forward_port 8443, 8443
|
||||
config.vm.forward_port 5901, 5901
|
||||
config.vm.forward_port 8787, 8787
|
||||
config.vm.forward_port 8250, 8250
|
||||
|
||||
config.vm.forward_port 8096, 8096
|
||||
config.vm.forward_port 7080, 7080
|
||||
# Ensure the VM has the right virtual resources
|
||||
#config.vm.
|
||||
|
||||
config.vm.customize ["modifyvm", :id, "--memory", 2048]
|
||||
config.vm.provision :shell, :path => "waitforxe.sh"
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "puppet-devcloud"
|
||||
puppet.manifest_file = "init.pp"
|
||||
puppet.with_ssh = true
|
||||
puppet.pp_path = "/etc/puppet"
|
||||
puppet.module_path = "puppet-devcloud"
|
||||
puppet.with_ssh = true
|
||||
puppet.manifests_path = File.join 'puppet', 'manifests'
|
||||
puppet.module_path = File.join 'puppet', 'modules', 'devcloud'
|
||||
puppet.manifest_file = 'vagrant-devcloud.pp'
|
||||
puppet.options = ['--pluginsync', '--trace', '--debug', '--verbose']
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# 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.
|
||||
|
||||
Vagrant::Config.run do |config|
|
||||
config.vm.box = "devcloudbase"
|
||||
# TODO: Get a URL to host the base image
|
||||
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
||||
config.vm.guest = :xen
|
||||
config.ssh.username = "devcloud"
|
||||
|
||||
# Uncomment this line to enable the console for debugging the
|
||||
# build process.
|
||||
#config.vm.boot_mode = :gui
|
||||
|
||||
# Setup port forwarding
|
||||
config.vm.forward_port 22, 2222
|
||||
config.vm.forward_port 8080, 8080
|
||||
config.vm.forward_port 8443, 8443
|
||||
config.vm.forward_port 5901, 5901
|
||||
config.vm.forward_port 8787, 8787
|
||||
config.vm.forward_port 8250, 8250
|
||||
|
||||
# Ensure the VM has the right virtual resources
|
||||
#config.vm.
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "puppet-devcloudinitial"
|
||||
puppet.manifest_file = "init.pp"
|
||||
puppet.with_ssh = true
|
||||
puppet.pp_path = "/etc/puppet"
|
||||
puppet.module_path = "puppet-devcloudinitial"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# 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.
|
||||
|
||||
include puppet-devcloudinitial
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
# 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.
|
||||
|
||||
class puppet-devcloudinitial {
|
||||
|
||||
package { 'linux-headers-3.2.0-23-generic':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'xen-hypervisor-4.1-i386':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'xcp-xapi':
|
||||
require => Package['xen-hypervisor-4.1-i386'],
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
file { '/etc/xcp/network.conf':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloudinitial/network.conf',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/etc/init.d/xend':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloudinitial/xend',
|
||||
group => '0',
|
||||
owner => '0',
|
||||
mode => '755',
|
||||
}
|
||||
|
||||
service { 'xendomains':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'stopped',
|
||||
enable => 'false',
|
||||
}
|
||||
|
||||
file { '/etc/default/grub':
|
||||
require => Package['xen-hypervisor-4.1-i386'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloudinitial/grub',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
exec { "/usr/sbin/update-grub":
|
||||
subscribe => File['/etc/default/grub'],
|
||||
refreshonly => true,
|
||||
cwd => '/',
|
||||
}
|
||||
|
||||
file { '/usr/share/qemu':
|
||||
require => Package['xen-hypervisor-4.1-i386'],
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/usr/share/qemu/keymaps':
|
||||
require => File['/usr/share/qemu'],
|
||||
ensure => 'link',
|
||||
group => '0',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
target => '/usr/share/qemu-linaro/keymaps',
|
||||
}
|
||||
|
||||
file { '/etc/network/interfaces':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloudinitial/interfaces',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/etc/default/xen':
|
||||
require => Package['xen-hypervisor-4.1-i386'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloudinitial/xen-defaults',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
#! /bin/bash -ex
|
||||
|
||||
vagrant halt
|
||||
vagrant package default --output devcloud.box
|
||||
vagrant box add devcloud devcloud.box -f
|
||||
|
|
@ -1,99 +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.
|
||||
|
||||
# Assumes that rvm is installed and you have ruby 1.9.2 installed
|
||||
# Assumes that you have virtual box installed
|
||||
# Assumes that you have wget installed
|
||||
set -x
|
||||
PROGNAME=$(basename $0)
|
||||
function error_exit {
|
||||
|
||||
# Display error message and exit
|
||||
echo "${PROGNAME}: $*" 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
# Load RVM into a shell session *as a function*
|
||||
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
||||
# First try to load from a user install
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
|
||||
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
||||
|
||||
# Then try to load from a root install
|
||||
source "/usr/local/rvm/scripts/rvm"
|
||||
|
||||
else
|
||||
|
||||
printf "ERROR: An RVM installation was not found.\n"
|
||||
|
||||
fi
|
||||
|
||||
mkdir ~/builddevcloud || error_exit
|
||||
cd ~/builddevcloud || error_exit
|
||||
git clone https://github.com/jedi4ever/veewee.git || error_exit
|
||||
#TODO: We need to get this patched version of Vagrant to the upstream project
|
||||
# or implement the desired changes to Vagrant as plugin modules and
|
||||
# host it within the ASF git repo
|
||||
git clone https://github.com/chipchilders/vagrant.git || error_exit
|
||||
export rvm_trust_rvmrcs_flag=1 || error_exit
|
||||
cd vagrant || error_exit
|
||||
bundle install || error_exit "could not bundle install vagrant"
|
||||
rake install || error_exit "could not rake vagrant"
|
||||
cd ~/builddevcloud/veewee || error_exit
|
||||
cp -R templates/ubuntu-12.04-server-i386 templates/ubuntu-12.04.1-server-i386
|
||||
cp -R templates/ubuntu-12.04-server-i386-packages templates/ubuntu-12.04.1-server-i386-packages
|
||||
bundle install || error_exit
|
||||
rake install || error_exit
|
||||
bundle exec vagrant basebox define 'devcloudbase' 'ubuntu-12.04.1-server-i386' || error_exit "couldn't basebox define"
|
||||
wget --no-check-certificate -O ./definitions/devcloudbase/definition.rb https://git-wip-us.apache.org/repos/asf\?p\=incubator-cloudstack.git\;a\=blob_plain\;f\=tools/devcloud/veewee/definition.rb\;hb\=HEAD || error_exit "couldn't get file"
|
||||
wget --no-check-certificate -O ./definitions/devcloudbase/postinstall.sh https://git-wip-us.apache.org/repos/asf\?p\=incubator-cloudstack.git\;a\=blob_plain\;f\=tools/devcloud/veewee/postinstall.sh\;hb\=HEAD || error_exit "couldn't get file"
|
||||
wget --no-check-certificate -O ./definitions/devcloudbase/preseed.cfg https://git-wip-us.apache.org/repos/asf\?p\=incubator-cloudstack.git\;a\=blob_plain\;f\=tools/devcloud/veewee/preseed.cfg\;hb\=HEAD || error_exit "couldn't get file"
|
||||
bundle exec vagrant basebox build 'devcloudbase' -f -a -n || error_exit "couldn't basebox build"
|
||||
# possibly use -r here too ^
|
||||
bundle exec vagrant basebox export 'devcloudbase' -f || error_exit "couldn't basebox export"
|
||||
bundle exec vagrant basebox destroy 'devcloudbase' -f || error_exit "couldn't basebox destroy"
|
||||
bundle exec vagrant box add 'devcloudbase' 'devcloudbase.box' -f || error_exit "couldn't basebox add"
|
||||
rm -f devcloudbase.box || error_exit
|
||||
cd ~/builddevcloud/vagrant || error_exit
|
||||
mkdir devcloudbase || error_exit
|
||||
cd devcloudbase || error_exit
|
||||
mkdir puppet-devcloudinitial || error_exit
|
||||
mkdir puppet-devcloudinitial/files || error_exit
|
||||
mkdir puppet-devcloudinitial/manifests || error_exit
|
||||
wget --no-check-certificate -O Vagrantfile "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/Vagrantfile;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/init.pp "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/init.pp;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/Modulefile "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/Modulefile;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/files/grub "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/files/grub;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/files/interfaces "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/files/interfaces;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/files/network.conf "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/files/xen-defaults "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/files/xen-defaults;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/files/xend "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/files/xend;hb=HEAD" || error_exit
|
||||
wget --no-check-certificate -O puppet-devcloudinitial/manifests/init.pp "https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp;hb=HEAD" || error_exit
|
||||
cd ~/builddevcloud/vagrant/
|
||||
bundle install || error_exit
|
||||
rake install || error_exit
|
||||
cd ~/builddevcloud/vagrant/devcloudbase/
|
||||
bundle exec vagrant up || error_exit "vagrant up failed"
|
||||
bundle exec vagrant halt || error_exit "vagrant halt failed"
|
||||
bundle exec vagrant package default --output ~/devcloud.box || error_exit "vagrant package failed"
|
||||
bundle exec vagrant destroy -f || error_exit "vagrant destroy failed"
|
||||
bundle exec vagrant box remove devcloudbase virtualbox || error_exit "vagrant box remove failed"
|
||||
|
||||
echo "Your new devcloud base box is stored in ~/devcloud.box"
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
#! /bin/bash
|
||||
|
||||
|
||||
# Load RVM into a shell session *as a function*
|
||||
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
||||
# First try to load from a user install
|
||||
source "$HOME/.rvm/scripts/rvm"
|
||||
|
||||
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
||||
|
||||
# Then try to load from a root install
|
||||
source "/usr/local/rvm/scripts/rvm"
|
||||
|
||||
else
|
||||
|
||||
printf "ERROR: An RVM installation was not found.\n"
|
||||
|
||||
fi
|
||||
|
||||
BASEDIR=$PWD/boxes
|
||||
DEVCLOUD_BASEBUILD_DIR=$BASEDIR/basebox-build
|
||||
echo $DEVCLOUD_BASEBUILD_DIR
|
||||
DEVCLOUD_XEN_BASEBUILD_DIR=$BASEDIR/xenbox-build
|
||||
DEVCLOUD_BASE_NAME='devcloudbase'
|
||||
DEVCLOUD_XEN_BASE_NAME='devcloudbase-xen'
|
||||
OS='ubuntu-12.04.1-server-i386'
|
||||
|
||||
|
||||
basebox() {
|
||||
set +x
|
||||
rvm rvmrc trust $DEVCLOUD_BASEBUILD_DIR/
|
||||
case "$1" in
|
||||
build)
|
||||
cd $DEVCLOUD_BASEBUILD_DIR/
|
||||
set -ex
|
||||
vagrant basebox define $DEVCLOUD_BASE_NAME $OS
|
||||
cp definition.rb postinstall.sh preseed.cfg definitions/$DEVCLOUD_BASE_NAME/
|
||||
vagrant basebox build $DEVCLOUD_BASE_NAME -f -a -n -r
|
||||
vagrant basebox export $DEVCLOUD_BASE_NAME -f
|
||||
set +ex
|
||||
cd $DEVCLOUD_XEN_BASEBUILD_DIR
|
||||
set -ex
|
||||
vagrant box add $DEVCLOUD_BASE_NAME $DEVCLOUD_BASEBUILD_DIR/${DEVCLOUD_BASE_NAME}.box -f
|
||||
;;
|
||||
clean)
|
||||
cd $DEVCLOUD_BASEBUILD_DIR/
|
||||
set -x
|
||||
rm -f iso/*.iso
|
||||
vagrant -f basebox destroy $DEVCLOUD_BASE_NAME #-f
|
||||
vagrant basebox undefine $DEVCLOUD_BASE_NAME
|
||||
#hackery to inherit the proper rvmrc for the hacked vagrant
|
||||
set +x
|
||||
cd $BAS$DEVCLOUD_XEN_BASEBUILD_DIR
|
||||
set -x
|
||||
vagrant -f box remove $DEVCLOUD_BASE_NAME virtualbox
|
||||
set +x
|
||||
cd $DEVCLOUD_BASEBUILD_DIR
|
||||
set -x
|
||||
rm -f ${DEVCLOUD_BASE_NAME}.box
|
||||
set +x
|
||||
cd $BASEDIR
|
||||
#rvm --force gemset delete vagrant-release-cloudstack
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
xenbox() {
|
||||
|
||||
set +x
|
||||
rvm rvmrc trust $DEVCLOUD_XEN_BASEBUILD_DIR/
|
||||
case "$1" in
|
||||
build)
|
||||
cd $DEVCLOUD_XEN_BASEBUILD_DIR
|
||||
|
||||
#adding it here because it needs to be added into the $VAGRANT_HOME of
|
||||
#the hacked vagrant
|
||||
set -ex
|
||||
vagrant up
|
||||
vagrant halt
|
||||
vagrant package default --output ${DEVCLOUD_XEN_BASE_NAME}.box
|
||||
vagrant box add $DEVCLOUD_XEN_BASE_NAME ${DEVCLOUD_XEN_BASE_NAME}.box -f
|
||||
;;
|
||||
clean)
|
||||
cd $DEVCLOUD_XEN_BASEBUILD_DIR
|
||||
set -x
|
||||
vagrant -f box remove $DEVCLOUD_XEN_BASE_NAME virtualbox
|
||||
vagrant destroy -f
|
||||
rm -f ${DEVCLOUD_XEN_BASE_NAME}.box
|
||||
set +x
|
||||
#rvm --force gemset delete vagrant-xen-cloudstack
|
||||
set -x
|
||||
;;
|
||||
esac
|
||||
}
|
||||
usage() {
|
||||
|
||||
cat <<EOF
|
||||
$(basename $0) [-h] [-b] [c] (basebox|xenbox) | all
|
||||
Builds / cleans boxes used to build the devcloud box
|
||||
|
||||
where:
|
||||
-h show this help text
|
||||
-b builds the box(es)
|
||||
-c cleans the box(es)
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts 'hbc' option; do
|
||||
case "$option" in
|
||||
h) usage
|
||||
exit
|
||||
;;
|
||||
b) action="build"
|
||||
;;
|
||||
c) action="clean"
|
||||
;;
|
||||
?) printf "illegal option: '%s'\n" "$OPTARG" >&2
|
||||
echo "$usage" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
posargs=$@
|
||||
|
||||
#removes duplicate positionals
|
||||
|
||||
posargs=$(echo "$posargs" | tr ' ' '\n' | nl | sort -u -k2 | sort -n | cut -f2-)
|
||||
|
||||
|
||||
|
||||
for arg in $posargs; do
|
||||
|
||||
case "$arg" in
|
||||
basebox)
|
||||
true
|
||||
;;
|
||||
xenbox)
|
||||
true
|
||||
;;
|
||||
all)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
|
||||
cd $BASEDIR
|
||||
|
||||
|
||||
for arg in $posargs; do
|
||||
case "$1" in
|
||||
"all")
|
||||
case "$action" in
|
||||
clean)
|
||||
xenbox $action
|
||||
basebox $action
|
||||
;;
|
||||
build)
|
||||
basebox $action
|
||||
xenbox $action
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
$arg)
|
||||
$arg $action
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
rvm use ruby-1.9.3@vagrant-release-cloudstack --create
|
||||
export VAGRANT_HOME=$HOME/.vagrant.d-release-cloudstack
|
||||
bundle check > /dev/null 2>&1
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
bundle install
|
||||
fi
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'veewee', :git => 'https://github.com/jedi4ever/veewee.git'
|
||||
gem 'em-winrm'
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
GIT
|
||||
remote: https://github.com/jedi4ever/veewee.git
|
||||
revision: b766b90aa1903b4bf7f28f0ea4922dce4471cd03
|
||||
specs:
|
||||
veewee (0.3.1)
|
||||
ansi (~> 1.3.0)
|
||||
childprocess
|
||||
cucumber (>= 1.0.0)
|
||||
fission (= 0.4.0)
|
||||
fog (~> 1.4)
|
||||
grit
|
||||
highline
|
||||
i18n
|
||||
net-ssh (~> 2.2.0)
|
||||
popen4 (~> 0.1.2)
|
||||
progressbar
|
||||
rspec (~> 2.5)
|
||||
ruby-vnc (~> 1.0.0)
|
||||
thor (~> 0.15)
|
||||
vagrant (>= 0.9)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (2.0.17)
|
||||
libxml-ruby (>= 1.1.0)
|
||||
rake (>= 0.7.0)
|
||||
Platform (0.4.0)
|
||||
akami (1.2.0)
|
||||
gyoku (>= 0.4.0)
|
||||
nokogiri (>= 1.4.0)
|
||||
ansi (1.3.0)
|
||||
archive-tar-minitar (0.5.2)
|
||||
builder (3.1.4)
|
||||
childprocess (0.3.6)
|
||||
ffi (~> 1.0, >= 1.0.6)
|
||||
cucumber (1.2.1)
|
||||
builder (>= 2.1.2)
|
||||
diff-lcs (>= 1.1.3)
|
||||
gherkin (~> 2.11.0)
|
||||
json (>= 1.4.6)
|
||||
diff-lcs (1.1.3)
|
||||
em-winrm (0.5.4)
|
||||
eventmachine (= 1.0.0.beta.3)
|
||||
mixlib-log (>= 1.3.0)
|
||||
uuidtools (~> 2.1.1)
|
||||
winrm (~> 1.1.0)
|
||||
erubis (2.7.0)
|
||||
eventmachine (1.0.0.beta.3)
|
||||
excon (0.16.10)
|
||||
ffi (1.2.0)
|
||||
fission (0.4.0)
|
||||
CFPropertyList (~> 2.0.17)
|
||||
fog (1.7.0)
|
||||
builder
|
||||
excon (~> 0.14)
|
||||
formatador (~> 0.2.0)
|
||||
mime-types
|
||||
multi_json (~> 1.0)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (>= 2.1.3)
|
||||
nokogiri (~> 1.5.0)
|
||||
ruby-hmac
|
||||
formatador (0.2.4)
|
||||
gherkin (2.11.5)
|
||||
json (>= 1.4.6)
|
||||
grit (2.5.0)
|
||||
diff-lcs (~> 1.1)
|
||||
mime-types (~> 1.15)
|
||||
posix-spawn (~> 0.3.6)
|
||||
gssapi (1.0.3)
|
||||
ffi (>= 1.0.1)
|
||||
gyoku (0.4.6)
|
||||
builder (>= 2.1.2)
|
||||
highline (1.6.15)
|
||||
httpclient (2.2.0.2)
|
||||
httpi (0.9.7)
|
||||
rack
|
||||
i18n (0.6.1)
|
||||
json (1.5.4)
|
||||
libxml-ruby (2.3.3)
|
||||
little-plugger (1.1.3)
|
||||
log4r (1.1.10)
|
||||
logging (1.6.2)
|
||||
little-plugger (>= 1.1.3)
|
||||
mime-types (1.19)
|
||||
mixlib-log (1.4.1)
|
||||
multi_json (1.3.7)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.2.2)
|
||||
nokogiri (1.5.5)
|
||||
nori (1.1.3)
|
||||
open4 (1.3.0)
|
||||
popen4 (0.1.2)
|
||||
Platform (>= 0.4.0)
|
||||
open4 (>= 0.4.0)
|
||||
posix-spawn (0.3.6)
|
||||
progressbar (0.11.0)
|
||||
rack (1.4.1)
|
||||
rake (10.0.2)
|
||||
rspec (2.12.0)
|
||||
rspec-core (~> 2.12.0)
|
||||
rspec-expectations (~> 2.12.0)
|
||||
rspec-mocks (~> 2.12.0)
|
||||
rspec-core (2.12.0)
|
||||
rspec-expectations (2.12.0)
|
||||
diff-lcs (~> 1.1.3)
|
||||
rspec-mocks (2.12.0)
|
||||
ruby-hmac (0.4.0)
|
||||
ruby-vnc (1.0.1)
|
||||
rubyntlm (0.1.1)
|
||||
savon (0.9.5)
|
||||
akami (~> 1.0)
|
||||
builder (>= 2.1.2)
|
||||
gyoku (>= 0.4.0)
|
||||
httpi (~> 0.9)
|
||||
nokogiri (>= 1.4.0)
|
||||
nori (~> 1.0)
|
||||
wasabi (~> 1.0)
|
||||
thor (0.16.0)
|
||||
uuidtools (2.1.3)
|
||||
vagrant (1.0.5)
|
||||
archive-tar-minitar (= 0.5.2)
|
||||
childprocess (~> 0.3.1)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6.0)
|
||||
json (~> 1.5.1)
|
||||
log4r (~> 1.1.9)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (~> 2.2.2)
|
||||
wasabi (1.0.0)
|
||||
nokogiri (>= 1.4.0)
|
||||
winrm (1.1.2)
|
||||
gssapi (~> 1.0.0)
|
||||
httpclient (~> 2.2.0.2)
|
||||
logging (~> 1.6.1)
|
||||
nokogiri (~> 1.5.0)
|
||||
rubyntlm (~> 0.1.1)
|
||||
savon (= 0.9.5)
|
||||
uuidtools (~> 2.1.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
em-winrm
|
||||
veewee!
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -28,9 +28,13 @@ Veewee::Session.declare({
|
|||
:iso_md5 => '32184a83c8b5e6031e1264e5c499bc03',
|
||||
:iso_download_timeout => "1000",
|
||||
:boot_wait => "4",
|
||||
:ioapic => "on",
|
||||
:nestedpaging => "on",
|
||||
:hwvirtex => "on",
|
||||
:virtualbox => {
|
||||
:vm_options => [
|
||||
"ioapic" => "on",
|
||||
"hwvirtex" => "on",
|
||||
"nestedpaging" => "on"
|
||||
]
|
||||
},
|
||||
:boot_cmd_sequence => [
|
||||
'<Esc><Esc><Enter>',
|
||||
'/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ',
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -40,4 +40,3 @@ chown -R devcloud /home/devcloud/.ssh
|
|||
# Zero out the free space to save space in the final image:
|
||||
dd if=/dev/zero of=/EMPTY bs=1M
|
||||
rm -f /EMPTY
|
||||
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
rvm use ruby-1.9.3@vagrant-xen-cloudstack --create
|
||||
export VAGRANT_HOME=$HOME/.vagrant.d-xen-cloudstack
|
||||
bundle check > /dev/null 2>&1
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
bundle install
|
||||
fi
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
source 'https://rubygems.org'
|
||||
gem 'vagrant', :git => 'https://github.com/chipchilders/vagrant'
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
GIT
|
||||
remote: https://github.com/chipchilders/vagrant
|
||||
revision: 781b2d974108a5421765883034fc27dd9857e9c0
|
||||
specs:
|
||||
vagrant (1.1.0.dev)
|
||||
archive-tar-minitar (= 0.5.2)
|
||||
childprocess (~> 0.3.1)
|
||||
erubis (~> 2.7.0)
|
||||
i18n (~> 0.6.0)
|
||||
json (~> 1.6.6)
|
||||
log4r (~> 1.1.9)
|
||||
net-scp (~> 1.0.4)
|
||||
net-ssh (~> 2.2.2)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
archive-tar-minitar (0.5.2)
|
||||
childprocess (0.3.6)
|
||||
ffi (~> 1.0, >= 1.0.6)
|
||||
erubis (2.7.0)
|
||||
ffi (1.2.0)
|
||||
i18n (0.6.1)
|
||||
json (1.6.7)
|
||||
log4r (1.1.10)
|
||||
net-scp (1.0.4)
|
||||
net-ssh (>= 1.99.1)
|
||||
net-ssh (2.2.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
vagrant!
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# 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.
|
||||
|
||||
Vagrant::Config.run do |config|
|
||||
config.vm.box = "devcloudbase"
|
||||
# TODO: Get a URL to host the base image
|
||||
# config.vm.box_url = "http://domain.com/path/to/above.box"
|
||||
config.vm.guest = :xen
|
||||
config.ssh.username = "devcloud"
|
||||
config.vm.host_name = "devcloud.local"
|
||||
|
||||
# Uncomment this line to enable the console for debugging the
|
||||
# build process.
|
||||
#config.vm.boot_mode = :gui
|
||||
|
||||
# Setup port forwarding
|
||||
# config.vm.forward_port 22, 2222
|
||||
# config.vm.forward_port 8080, 8080
|
||||
# config.vm.forward_port 8443, 8443
|
||||
# config.vm.forward_port 5901, 5901
|
||||
# config.vm.forward_port 8787, 8787
|
||||
# config.vm.forward_port 8250, 8250
|
||||
|
||||
# Ensure the VM has the right virtual resources
|
||||
#config.vm.
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.with_ssh = true
|
||||
puppet.manifests_path = File.join 'puppet', 'manifests'
|
||||
puppet.module_path = File.join 'puppet', 'modules', 'devcloudinitial'
|
||||
puppet.manifest_file = 'vagrant-devcloudinitial.pp'
|
||||
puppet.options = ['--trace', '--debug', '--verbose']
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
node default { include devcloudinitial }
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -30,4 +30,3 @@ auto eth0
|
|||
iface eth0 inet dhcp
|
||||
pre-up iptables-save < /etc/iptables.save
|
||||
pre-up /etc/init.d/ebtables load
|
||||
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
# 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.
|
||||
|
||||
class devcloudinitial {
|
||||
|
||||
if $::architecture == 'x86_64'{
|
||||
$debarch='amd64'
|
||||
}
|
||||
else {
|
||||
$debarch='i386'
|
||||
}
|
||||
package {
|
||||
"linux-headers-${::kernelrelease}":
|
||||
ensure => latest;
|
||||
"xen-hypervisor-4.1-${debarch}":
|
||||
ensure => latest,
|
||||
require => Package["linux-headers-${::kernelrelease}"];
|
||||
"xcp-xapi":
|
||||
require => Package["xen-hypervisor-4.1-${debarch}"],
|
||||
ensure => latest;
|
||||
}
|
||||
|
||||
file {
|
||||
'/etc/xcp/network.conf':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloudinitial/network.conf',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0';
|
||||
'/etc/init.d/xend':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloudinitial/xend',
|
||||
group => '0',
|
||||
owner => '0',
|
||||
mode => '755';
|
||||
'/etc/default/grub':
|
||||
require => Package["xen-hypervisor-4.1-${debarch}"],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloudinitial/grub',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0';
|
||||
'/usr/share/qemu':
|
||||
require => Package["xen-hypervisor-4.1-${debarch}"],
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0';
|
||||
'/usr/share/qemu/keymaps':
|
||||
require => File['/usr/share/qemu'],
|
||||
ensure => 'link',
|
||||
group => '0',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
target => '/usr/share/qemu-linaro/keymaps';
|
||||
'/etc/network/interfaces':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloudinitial/interfaces',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0';
|
||||
'/etc/default/xen':
|
||||
require => Package["xen-hypervisor-4.1-${debarch}"],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloudinitial/xen-defaults',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0';
|
||||
|
||||
}
|
||||
|
||||
service {
|
||||
'xendomains':
|
||||
require => Package['xcp-xapi'],
|
||||
ensure => 'stopped',
|
||||
enable => false;
|
||||
}
|
||||
|
||||
|
||||
exec { "/usr/sbin/update-grub":
|
||||
subscribe => File['/etc/default/grub'],
|
||||
refreshonly => true,
|
||||
cwd => '/',
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,348 +0,0 @@
|
|||
# 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.
|
||||
|
||||
class puppet-devcloud {
|
||||
|
||||
package { 'ebtables':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
service { 'ebtables':
|
||||
require => Package['ebtables'],
|
||||
ensure => 'running',
|
||||
enable => 'true',
|
||||
}
|
||||
|
||||
package { 'iptables':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
file { '/etc/iptables.save':
|
||||
require => Package['iptables'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/iptables.save',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/tmp/configebtables.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/configebtables.sh',
|
||||
group => '0',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
exec { "/tmp/configebtables.sh":
|
||||
require => [
|
||||
File['/tmp/configebtables.sh'],
|
||||
Service['ebtables']
|
||||
],
|
||||
subscribe => Package['ebtables'],
|
||||
refreshonly => true,
|
||||
cwd => '/',
|
||||
path => '/sbin/:/usr/bin/:/bin',
|
||||
}
|
||||
|
||||
package { 'nfs-server':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
file { '/opt/storage':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary/template':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary/template/tmpl':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary/template/tmpl/1':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary/template/tmpl/1/1':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/opt/storage/secondary/template/tmpl/1/5':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/etc/exports':
|
||||
require => Package['nfs-server'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/exports',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
}
|
||||
|
||||
service { 'nfs-kernel-server':
|
||||
require => Package['nfs-server'],
|
||||
ensure => 'running',
|
||||
enable => 'true',
|
||||
}
|
||||
|
||||
# TODO - it would be great to have an MD5 sum to check for each of these downloads, so that the files can be re-downloaded if they have been changed.
|
||||
|
||||
exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd -P /opt/storage/secondary/template/tmpl/1/1/':
|
||||
creates => '/opt/storage/secondary/template/tmpl/1/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd',
|
||||
require => File['/opt/storage/secondary/template/tmpl/1/1/'],
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/template.properties -P /opt/storage/secondary/template/tmpl/1/1/':
|
||||
creates => '/opt/storage/secondary/template/tmpl/1/1/template.properties',
|
||||
require => File['/opt/storage/secondary/template/tmpl/1/1/'],
|
||||
}
|
||||
|
||||
exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd -P /opt/storage/secondary/template/tmpl/1/5/':
|
||||
creates => '/opt/storage/secondary/template/tmpl/1/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd',
|
||||
require => File['/opt/storage/secondary/template/tmpl/1/5/'],
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/template.properties -P /opt/storage/secondary/template/tmpl/1/5/':
|
||||
creates => '/opt/storage/secondary/template/tmpl/1/5/template.properties',
|
||||
require => File['/opt/storage/secondary/template/tmpl/1/5/'],
|
||||
}
|
||||
|
||||
exec { 'getecho':
|
||||
command => '/usr/bin/wget http://download.cloud.com/templates/devcloud/echo -P /usr/lib/xcp/plugins/',
|
||||
creates => '/usr/lib/xcp/plugins/echo',
|
||||
}
|
||||
|
||||
exec { '/bin/chmod -R 777 /usr/lib/xcp':
|
||||
require => Exec['getecho'],
|
||||
}
|
||||
|
||||
file { '/opt/storage/primary':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/tmp/configlocalstorage.sh':
|
||||
ensure => 'file',
|
||||
group => '0',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
source => 'puppet:///modules/puppet-devcloud/configlocalstorage.sh',
|
||||
}
|
||||
|
||||
exec { "configlocal":
|
||||
require => [
|
||||
File['/opt/storage/primary'],
|
||||
File['/tmp/configlocalstorage.sh']
|
||||
],
|
||||
command => '/tmp/configlocalstorage.sh',
|
||||
cwd => '/',
|
||||
}
|
||||
|
||||
file { '/tmp/configvnc.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/configvnc.sh',
|
||||
mode => '777',
|
||||
group => '0',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
exec { "configvnc":
|
||||
require => File['/tmp/configvnc.sh'],
|
||||
command => '/tmp/configvnc.sh',
|
||||
cwd => '/',
|
||||
}
|
||||
|
||||
package { 'git':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'unzip':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'mysql-server':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'ant':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
package { 'openjdk-6-jdk':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
}
|
||||
|
||||
file { '/tmp/updatecode.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/updatecode.sh',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
}
|
||||
|
||||
exec { 'get_code':
|
||||
require => [
|
||||
Package['git'],
|
||||
File['/opt/cloudstack/'],
|
||||
File['/tmp/updatecode.sh']
|
||||
],
|
||||
command => '/tmp/updatecode.sh',
|
||||
cwd => '/opt/cloudstack/',
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack/incubator-cloudstack/target':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
require => Exec['get_code'],
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack/incubator-cloudstack/dist':
|
||||
ensure => 'directory',
|
||||
group => '0',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
require => Exec['get_code'],
|
||||
}
|
||||
|
||||
exec { 'downloadtomcat':
|
||||
command => '/usr/bin/wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/',
|
||||
creates => '/opt/cloudstack/apache-tomcat-6.0.32.zip',
|
||||
require => File['/opt/cloudstack/'],
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
exec { "unziptomcat":
|
||||
require => [
|
||||
Package['unzip'],
|
||||
Exec["downloadtomcat"]
|
||||
],
|
||||
creates => "/opt/cloudstack/apache-tomcat-6.0.32",
|
||||
command => "/usr/bin/unzip apache-tomcat-6.0.32.zip",
|
||||
cwd => "/opt/cloudstack",
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
exec { "catalina_home":
|
||||
require => Exec["unziptomcat"],
|
||||
unless => '/bin/grep CATALINA_HOME /root/.bashrc',
|
||||
command => '/bin/echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc',
|
||||
cwd => '/',
|
||||
}
|
||||
|
||||
package { 'mkisofs':
|
||||
ensure => latest,
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack/buildcloudstack.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/builddevcloud.sh',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack/installmaven.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/installmaven.sh',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
}
|
||||
|
||||
exec { "install_maven":
|
||||
require => File['/opt/cloudstack/installmaven.sh'],
|
||||
command => '/opt/cloudstack/installmaven.sh',
|
||||
cwd => '/opt/cloudstack',
|
||||
creates => '/opt/cloudstack/apache-maven-3.0.4/',
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
exec { "build_cloudstack":
|
||||
require => [
|
||||
Package['ant'],
|
||||
Exec['install_maven'],
|
||||
Exec["catalina_home"],
|
||||
File['/opt/cloudstack/incubator-cloudstack/dist'],
|
||||
File['/opt/cloudstack/incubator-cloudstack/target'],
|
||||
Package['mkisofs'],
|
||||
File['/opt/cloudstack/buildcloudstack.sh']
|
||||
],
|
||||
command => "/opt/cloudstack/buildcloudstack.sh",
|
||||
cwd => "/opt/cloudstack/",
|
||||
timeout => '0',
|
||||
}
|
||||
|
||||
file { '/opt/cloudstack/startdevcloud.sh':
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/puppet-devcloud/startdevcloud.sh',
|
||||
mode => '777',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
}
|
||||
|
||||
exec { "start_cloudstack":
|
||||
require => [
|
||||
Exec["build_cloudstack"],
|
||||
File["/opt/cloudstack/startdevcloud.sh"]
|
||||
],
|
||||
command => "/opt/cloudstack/startdevcloud.sh",
|
||||
cwd => "/opt/cloudstack/",
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,151 +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.
|
||||
|
||||
fileSvr="http://download.cloud.com/templates/devcloud/"
|
||||
install_xen() {
|
||||
aptitude update
|
||||
echo "install xen"
|
||||
aptitude -y install linux-headers-3.2.0-23-generic-pae
|
||||
aptitude -y install xen-hypervisor-4.1-i386 xcp-xapi
|
||||
echo "configure xen"
|
||||
|
||||
sed -i -e 's/xend_start$/#xend_start/' -e 's/xend_stop$/#xend_stop/' /etc/init.d/xend
|
||||
update-rc.d xendomains disable
|
||||
|
||||
sed -i 's/GRUB_DEFAULT=.\+/GRUB_DEFAULT="Xen 4.1-i386"/' /etc/default/grub
|
||||
echo 'GRUB_CMDLINE_XEN_DEFAULT="dom0_mem=512M,max:512M"' | cat /etc/default/grub - >> /etc/default/newgrub
|
||||
mv /etc/default/newgrub /etc/default/grub
|
||||
update-grub
|
||||
|
||||
mkdir /usr/share/qemu
|
||||
ln -s /usr/share/qemu-linaro/keymaps /usr/share/qemu/keymaps
|
||||
|
||||
cat > /etc/network/interfaces << EOF
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# The primary network interface
|
||||
auto xenbr0
|
||||
iface xenbr0 inet dhcp
|
||||
gateway 10.0.2.2
|
||||
bridge_ports eth0
|
||||
|
||||
|
||||
auto eth0
|
||||
iface eth0 inet dhcp
|
||||
pre-up iptables-save < /etc/iptables.save
|
||||
pre-up /etc/init.d/ebtables load
|
||||
EOF
|
||||
|
||||
echo TOOLSTACK=xapi > /etc/default/xen
|
||||
echo bridge > /etc/xcp/network.conf
|
||||
|
||||
echo "set root password"
|
||||
echo "root:password" | chpasswd
|
||||
|
||||
echo "reboot"
|
||||
reboot
|
||||
}
|
||||
|
||||
postsetup() {
|
||||
#check xen dom0 is working
|
||||
xe host-list > /dev/null
|
||||
if [ $? -gt 0 ]; then
|
||||
print "xen dom0 is not running, make sure dom0 is installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#disable virtualbox dhcp server for Vms created by cloudstack
|
||||
apt-get install ebtables
|
||||
iptables -A POSTROUTING -t mangle -p udp --dport bootpc -j CHECKSUM --checksum-fill
|
||||
mac=`ifconfig xenbr0 |grep HWaddr |awk '{print $5}'`
|
||||
ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP
|
||||
iptables-save > /etc/iptables.save
|
||||
/etc/init.d/ebtables save
|
||||
|
||||
echo "configure NFS server"
|
||||
aptitude -y install nfs-server
|
||||
if [ ! -d /opt/storage/secondary ];then
|
||||
mkdir -p /opt/storage/secondary
|
||||
mkdir -p /opt/storage/secondary/template/tmpl/1/1
|
||||
mkdir -p /opt/storage/secondary/template/tmpl/1/5
|
||||
|
||||
echo "/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0)" > /etc/exports
|
||||
wget $fileSvr/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd -P /opt/storage/secondary/template/tmpl/1/1/
|
||||
wget $fileSvr/defaulttemplates/1/template.properties -P /opt/storage/secondary/template/tmpl/1/1/
|
||||
wget $fileSvr/defaulttemplates/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd -P /opt/storage/secondary/template/tmpl/1/5/
|
||||
wget $fileSvr/defaulttemplates/5/template.properties -P /opt/storage/secondary/template/tmpl/1/5/
|
||||
/etc/init.d/nfs-kernel-server restart
|
||||
fi
|
||||
|
||||
echo "configure local storage"
|
||||
if [ ! -d /opt/storage/primary ]; then
|
||||
mkdir -p /opt/storage/primary
|
||||
hostuuid=`xe host-list |grep uuid|awk '{print $5}'`
|
||||
xe sr-create host-uuid=$hostuuid name-label=local-storage shared=false type=file device-config:location=/opt/storage/primary
|
||||
fi
|
||||
|
||||
echo "generate ssh key"
|
||||
ssh-keygen -A -q
|
||||
|
||||
echo "configure xcp"
|
||||
wget $fileSvr/echo -P /usr/lib/xcp/plugins/
|
||||
chmod -R 777 /usr/lib/xcp
|
||||
|
||||
sed -i 's/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/' /usr/lib/xcp/lib/vncterm-wrapper
|
||||
|
||||
echo "install cloudstack "
|
||||
|
||||
if [ ! -d /opt/cloudstack ];then
|
||||
aptitude -y install git unzip openjdk-6-jdk mysql-server ant
|
||||
mkdir /opt/cloudstack
|
||||
cd /opt/cloudstack
|
||||
git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git
|
||||
mkdir incubator-cloudstack/target
|
||||
mkdir incubator-cloudstack/dist
|
||||
wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/
|
||||
unzip apache-tomcat-6.0.32.zip
|
||||
echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc
|
||||
cd ~
|
||||
fi
|
||||
|
||||
echo "devCloud is ready to use"
|
||||
}
|
||||
usage() {
|
||||
print "$0 -p: presetup enviroment, e.g. install xen, configure xcp etc"
|
||||
print "$0 -P: postsetup, install cloudstack, prepare template etc"
|
||||
}
|
||||
|
||||
while getopts "pP" OPTION
|
||||
do
|
||||
case $OPTION in
|
||||
p)
|
||||
install_xen
|
||||
exit 0
|
||||
;;
|
||||
P)
|
||||
postsetup
|
||||
exit 0
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -15,4 +15,4 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
include puppet-devcloud
|
||||
include devcloud
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
#! /bin/bash -eux
|
||||
|
||||
FILE=$1
|
||||
WORKING_DIR=$2
|
||||
cd $WORKING_DIR
|
||||
test `grep $FILE ${WORKING_DIR}/md5sum.txt | awk '{print $1}'` == `md5sum $FILE |awk '{print $1}'`
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
/usr/bin/xe sr-list | /bin/grep local-storage
|
||||
rc=$?
|
||||
if [[ $rc != 0 ]] ; then
|
||||
hostuuid=`xe host-list |grep uuid|awk '{print $5}'`;
|
||||
hostuuid=`xe host-list |grep uuid|awk '{print $5}'`;
|
||||
xe sr-create host-uuid=$hostuuid name-label=local-storage shared=false type=file device-config:location=/opt/storage/primary
|
||||
fi
|
||||
exit 0
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -15,4 +15,5 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
/opt/storage/primary *(rw,no_subtree_check,no_root_squash,fsid=0)
|
||||
/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0)
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
# 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
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -19,5 +19,5 @@
|
|||
|
||||
export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32
|
||||
cd /opt/cloudstack/incubator-cloudstack/
|
||||
nohup ant run > /dev/null 2>&1 &
|
||||
nohup ant run > /dev/null 2>&1 &
|
||||
exit 0
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
Facter.add(:xen_hostuuid) do
|
||||
setcode do
|
||||
uuid=Facter::Util::Resolution.exec('xe host-list |grep uuid|awk \'{print $5}\'')
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
define devcloud::functions::httpdownload () {
|
||||
$file="${name['basedir']}/${name['basefile']}"
|
||||
|
||||
exec {
|
||||
"getfileifnotexist${name}":
|
||||
command => "/usr/bin/wget ${name['url']}/${file} -O ${name['local_dir']}/${file}",
|
||||
timeout => 0,
|
||||
unless => "test -f ${name['local_dir']}/${file}",
|
||||
require => [ File["${name['local_dir']}/${name['base_dir']}/"],
|
||||
Exec["get_md5sums"] ];
|
||||
|
||||
|
||||
"getfileifnotmatch${name}":
|
||||
command => "/usr/bin/wget ${name['url']}/${file} -O ${name['local_dir']}/${file}",
|
||||
timeout => 0,
|
||||
unless => "/usr/local/bin/compare.sh ${file} ${name['working_dir']} ",
|
||||
require => [ Exec["getfileifnotexist${name}"], File["/usr/local/bin/compare.sh"] ]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
# 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 permission s and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
||||
class devcloud (
|
||||
|
||||
$cs_dir = $devcloud::params::cs_dir ,
|
||||
$devcloud_path = $devcloud::params::devcloud_path,
|
||||
$gitrepo = $devcloud::params::gitrepo,
|
||||
$storage_dir = $devcloud::params::storage_dir,
|
||||
$tomcat_version = $devcloud::params::tomcat_version,
|
||||
$tomcat_url = $devcloud::params::tomcat_url,
|
||||
$tomcat_home = $devcloud::params::tomcat_home,
|
||||
$maven_version = $devcloud::params::maven_version,
|
||||
$maven_url = $devcloud::params::maven_url,
|
||||
$maven_home = $devcloud::params::maven_home,
|
||||
$downloads = $devcloud::params::downloads,
|
||||
$md5sum_local = $devcloud::params::md5sum_local,
|
||||
$md5sum_remote = $devcloud::params::md5sum_remote,
|
||||
$hostuuid = $::xen_hostuuid,
|
||||
$bridge_device_mac = $::macaddress_xenbr0
|
||||
|
||||
) inherits devcloud::params {
|
||||
|
||||
|
||||
|
||||
Exec { path => [ "/bin/", "/sbin/" , "/usr/bin/", "/usr/sbin/" ] }
|
||||
|
||||
service {
|
||||
'ebtables':
|
||||
require => Package['ebtables'],
|
||||
ensure => 'running',
|
||||
enable => true;
|
||||
'nfs-kernel-server':
|
||||
require => Package['nfs-server'],
|
||||
ensure => 'running',
|
||||
enable => true,
|
||||
subscribe => File["/etc/exports"];
|
||||
}
|
||||
|
||||
package { [
|
||||
"ant",
|
||||
"ebtables",
|
||||
"iptables",
|
||||
"git",
|
||||
"mkisofs",
|
||||
"mysql-server",
|
||||
"nfs-server",
|
||||
"openjdk-6-jdk",
|
||||
"unzip"
|
||||
]:
|
||||
ensure => latest,
|
||||
|
||||
}
|
||||
|
||||
exec {
|
||||
|
||||
'get_md5sums':
|
||||
command => "/usr/bin/wget -N ${md5sum_remote} -O ${md5sum_local}",
|
||||
require => File["${storage_dir}/secondary/template/tmpl/1/"],
|
||||
timeout => '0';
|
||||
|
||||
'getecho':
|
||||
command => "/usr/bin/wget ${devcloud_path}/echo -O /usr/lib/xcp/plugins/echo",
|
||||
creates => '/usr/lib/xcp/plugins/echo';
|
||||
|
||||
'setxcpperms':
|
||||
command => '/bin/chmod -R 755 /usr/lib/xcp',
|
||||
require => Exec['getecho'];
|
||||
|
||||
'get_code':
|
||||
command => "git clone ${gitrepo}",
|
||||
cwd => $cs_dir,
|
||||
require => [ File["${cs_dir}"]],
|
||||
timeout => '7200',
|
||||
creates => "$cs_dir/incubator-cloudstack";
|
||||
|
||||
'update_code':
|
||||
command => "git pull origin master",
|
||||
cwd => "${cs_dir}/incubator-cloudstack",
|
||||
timeout => '7200',
|
||||
require => [ Exec["get_code"]];
|
||||
|
||||
"configlocal":
|
||||
command => "xe sr-create host-uuid=${hostuuid} name-label=local-storage shared=false type=file device-config:location=${storage_dir}/primary",
|
||||
cwd => '/',
|
||||
unless => '/usr/bin/xe sr-list | /bin/egrep \'local-storage|Cloud Stack Local EXT Storage Pool\'',
|
||||
require => [
|
||||
File["${storage_dir}/primary"],
|
||||
File["/etc/iptables.save"]
|
||||
];
|
||||
|
||||
"configvnc":
|
||||
command => 'sed -i \'s/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/\' /usr/lib/xcp/lib/vncterm-wrapper',
|
||||
onlyif => '/bin/grep "0.0.0.0:1" /usr/lib/xcp/lib/vncterm-wrapper';
|
||||
|
||||
'downloadtomcat':
|
||||
command => "/usr/bin/wget ${tomcat_url} -P ${cs_dir}/",
|
||||
creates => "${cs_dir}/apache-tomcat-${tomcat_version}.zip",
|
||||
require => File[$cs_dir],
|
||||
timeout => '0';
|
||||
|
||||
"unziptomcat":
|
||||
require => [
|
||||
Package['unzip'],
|
||||
Exec["downloadtomcat"]
|
||||
],
|
||||
creates => "${tomcat_home}",
|
||||
command => "/usr/bin/unzip apache-tomcat-${tomcat_version}.zip",
|
||||
cwd => "${cs_dir}",
|
||||
timeout => '0';
|
||||
|
||||
"downloadmaven":
|
||||
command => "/usr/bin/wget ${maven_url} -P ${cs_dir}/",
|
||||
creates => "${cs_dir}/apache-maven-${maven_version}-bin.tar.gz",
|
||||
require => Exec['unziptomcat'],
|
||||
timeout => '0';
|
||||
|
||||
"build_cloudstack":
|
||||
require => [
|
||||
Package["ant"],
|
||||
Exec["install_maven"],
|
||||
File["${cs_dir}/incubator-cloudstack/dist"],
|
||||
File["${cs_dir}/incubator-cloudstack/target"],
|
||||
Package['mkisofs'],
|
||||
File["${cs_dir}/buildcloudstack.sh"]
|
||||
],
|
||||
command => "/opt/cloudstack/buildcloudstack.sh",
|
||||
cwd => "/opt/cloudstack/",
|
||||
timeout => '0';
|
||||
|
||||
|
||||
"install_maven":
|
||||
require => Exec["downloadmaven"],
|
||||
creates => "${maven_home}",
|
||||
command => "/bin/tar xzvf ${cs_dir}/apache-maven-${maven_version}-bin.tar.gz",
|
||||
cwd => "${cs_dir}",
|
||||
timeout => '0';
|
||||
|
||||
'tomcatperms':
|
||||
command => "chmod +x ${tomcat_home}/bin/*.sh",
|
||||
require => Exec["unziptomcat"],;
|
||||
|
||||
"catalina_home":
|
||||
require => Exec["unziptomcat"],
|
||||
unless => '/bin/grep CATALINA_HOME /root/.bashrc',
|
||||
command => "/bin/echo \"export CATALINA_HOME=${tomcat_home}\" >> /root/.bashrc",
|
||||
cwd => '/';
|
||||
"configebtables":
|
||||
require => [
|
||||
Service['ebtables']
|
||||
],
|
||||
command => "/sbin/ebtables -I FORWARD -d ! $bridge_device_mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP",
|
||||
subscribe => Package["ebtables"],
|
||||
unless => "/sbin/ebtables -L | grep \"-I FORWARD -d ! $bridge_device_mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP\"",
|
||||
refreshonly => true,
|
||||
cwd => "/",
|
||||
path => "/sbin/:/usr/bin/:/bin"
|
||||
}
|
||||
|
||||
|
||||
file {
|
||||
|
||||
[ $cs_dir,
|
||||
"${storage_dir}",
|
||||
"${storage_dir}/primary",
|
||||
"${storage_dir}/secondary",
|
||||
"${storage_dir}/secondary/template",
|
||||
"${storage_dir}/secondary/template/tmpl",
|
||||
"${storage_dir}/secondary/template/tmpl/1",
|
||||
"${storage_dir}/secondary/template/tmpl/1/1",
|
||||
"${storage_dir}/secondary/template/tmpl/1/5" ]:
|
||||
ensure => "directory",
|
||||
group => "0",
|
||||
mode => "755",
|
||||
owner => "0";
|
||||
|
||||
[ "${cs_dir}/incubator-cloudstack/dist",
|
||||
"${cs_dir}/incubator-cloudstack/target" ] :
|
||||
ensure => "directory",
|
||||
group => "0",
|
||||
mode => "755",
|
||||
owner => "0",
|
||||
require => [ Exec["update_code"]];
|
||||
|
||||
"${cs_dir}/buildcloudstack.sh":
|
||||
ensure => 'file',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
group => '0',
|
||||
content => template("devcloud/builddevcloud.sh.erb");
|
||||
|
||||
"/root/.ssh" :
|
||||
ensure => "directory",
|
||||
group => "root",
|
||||
mode => "700",
|
||||
owner => "root";
|
||||
|
||||
"${cs_dir}/startdevcloud.sh":
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloud/startdevcloud.sh',
|
||||
mode => '755',
|
||||
owner => '0',
|
||||
group => '0';
|
||||
"/usr/local/bin/compare.sh":
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloud/compare.sh',
|
||||
mode => '755',
|
||||
owner => 'root',
|
||||
group => 'root';
|
||||
'/etc/iptables.save':
|
||||
require => Package['iptables'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloud/iptables.save',
|
||||
group => '0',
|
||||
mode => '644',
|
||||
owner => '0';
|
||||
"/etc/exports":
|
||||
require => Package['nfs-server'],
|
||||
ensure => 'file',
|
||||
source => 'puppet:///modules/devcloud/exports',
|
||||
mode => '644',
|
||||
owner => '0',
|
||||
group => '0';
|
||||
|
||||
}
|
||||
|
||||
|
||||
devcloud::functions::httpdownload{
|
||||
$downloads:
|
||||
require => [ File["${storage_dir}/secondary/template/tmpl/1/1"],
|
||||
File["${storage_dir}/secondary/template/tmpl/1/5"],
|
||||
Exec["get_md5sums"]
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
# == Class: devcloud::params
|
||||
#
|
||||
# This class implements the module params pattern, but it's loaded using hiera
|
||||
# as opposed to the 'default' usage of coding the parameter values in your
|
||||
# manifest.
|
||||
#
|
||||
# == Usage
|
||||
#
|
||||
# Don't use this class directly; it's being used where it is needed
|
||||
#
|
||||
class devcloud::params {
|
||||
|
||||
|
||||
|
||||
|
||||
$cs_dir = "/opt/cloudstack"
|
||||
$storage_dir = "/opt/storage"
|
||||
$tomcat_version = "6.0.32"
|
||||
$tomcat_url = "http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat_version}/bin/apache-tomcat-${tomcat_version}.zip"
|
||||
$tomcat_home = "${cs_dir}/apache-tomcat-${tomcat_version}"
|
||||
$maven_version = "3.0.4"
|
||||
$maven_url = "http://apache.mirrors.pair.com/maven/maven-3/${maven_version}/binaries/apache-maven-${maven_version}-bin.tar.gz"
|
||||
$maven_home = "${cs_dir}/apache-maven-${maven_version}"
|
||||
$devcloud_path = "http://download.cloud.com/templates/devcloud"
|
||||
$template_path = "${devcloud_path}/defaulttemplates"
|
||||
$md5sum_remote = "${template_path}/md5sum.txt"
|
||||
$md5sum_local = "${storage_dir}/secondary/template/tmpl/1/md5sum.txt"
|
||||
$template_dir = "${storage_dir}/secondary/template/tmpl/1"
|
||||
$gitrepo = "https://github.com/apache/incubator-cloudstack.git"
|
||||
|
||||
|
||||
|
||||
$downloads = [
|
||||
|
||||
{
|
||||
"basefile" => "template.properties",
|
||||
"basedir" => "1",
|
||||
"url" => "${template_path}",
|
||||
"local_dir" => "$template_dir",
|
||||
"working_dir" => "$template_dir"
|
||||
},
|
||||
{
|
||||
"basefile" => "template.properties",
|
||||
"basedir" => "5",
|
||||
"url" => "${template_path}",
|
||||
"local_dir" => "$template_dir",
|
||||
"working_dir" => "$template_dir"
|
||||
},
|
||||
{
|
||||
"basefile" => "dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd",
|
||||
"basedir" => "1",
|
||||
"url" => "${template_path}",
|
||||
"local_dir" => "$template_dir",
|
||||
"working_dir" => "$template_dir"
|
||||
},
|
||||
{
|
||||
"basefile" => "ce5b212e-215a-3461-94fb-814a635b2215.vhd",
|
||||
"basedir" => "5",
|
||||
"url" => "${template_path}",
|
||||
"local_dir" => "$template_dir",
|
||||
"working_dir" => "$template_dir"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
# 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
|
||||
|
|
@ -17,12 +17,12 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32
|
||||
export M2_HOME=/opt/cloudstack/apache-maven-3.0.4
|
||||
export CATALINA_HOME=<%= @tomcat_home %>
|
||||
export M2_HOME=<%= @maven_home %>
|
||||
export M2=$M2_HOME/bin
|
||||
MAVEN_OPTS="-Xms256m -Xmx512m"
|
||||
PATH=$M2:$PATH
|
||||
cd /opt/cloudstack/incubator-cloudstack/
|
||||
/usr/bin/mvn -P deps
|
||||
/usr/bin/mvn clean
|
||||
/usr/bin/ant clean-all build-all deploy-server deploydb
|
||||
cd <%= @cs_dir %>/incubator-cloudstack/
|
||||
<%= @maven_home %>/bin/mvn -P developer clean install
|
||||
<%= @maven_home %>/bin/mvn -P developer -pl developer,tools/devcloud -Ddeploydb
|
||||
<%= @maven_home %>/bin/mvn -P developer -pl tools/devcloud -Ddeploysvr
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#! /bin/bash
|
||||
date
|
||||
interval=20
|
||||
timeout=300
|
||||
command="xe host-list"
|
||||
|
||||
count=0
|
||||
maxcount=$(($timeout/$interval))
|
||||
|
||||
|
||||
until [ $count -gt $maxcount ]; do
|
||||
if $command > /dev/null 2>&1; then
|
||||
echo "\"$command\" executed successfully."
|
||||
date
|
||||
exit 0
|
||||
fi
|
||||
let count=count+1
|
||||
echo "Waiting for \"$command\" to run successfully."
|
||||
sleep $interval
|
||||
done
|
||||
|
||||
echo "\"$command\" failed to complete."
|
||||
date
|
||||
Loading…
Reference in New Issue