diff --git a/tools/devcloud/vagrant/Vagrantfile b/tools/devcloud/basebuild/Vagrantfile similarity index 66% rename from tools/devcloud/vagrant/Vagrantfile rename to tools/devcloud/basebuild/Vagrantfile index d2a9c9926c7..eee8127cd2f 100644 --- a/tools/devcloud/vagrant/Vagrantfile +++ b/tools/devcloud/basebuild/Vagrantfile @@ -19,13 +19,15 @@ # under the License. Vagrant::Config.run do |config| - config.vm.box = "devcloudbase-ubuntu-12-04-64bit" + 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.guest = :xen + config.ssh.username = "devcloud" # Uncomment this line to enable the console for debugging the # build process. - #config.vm.boot_mode = :gui + config.vm.boot_mode = :gui # Setup port forwarding config.vm.forward_port 22, 2222 @@ -46,27 +48,4 @@ Vagrant::Config.run do |config| puppet.module_path = "puppet-devcloudinitial" end - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file my_box.pp in the manifests_path directory. - # - # An example Puppet manifest to provision the message of the day: - # - # # group { "puppet": - # # ensure => "present", - # # } - # # - # # File { owner => 0, group => 0, mode => 0644 } - # # - # # file { '/etc/motd': - # # content => "Welcome to your Vagrant-built virtual machine! - # # Managed by Puppet.\n" - # # } - # - # config.vm.provision :puppet do |puppet| - # puppet.manifests_path = "manifests" - # puppet.manifest_file = "my_box.pp" - # end - end diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile b/tools/devcloud/basebuild/puppet-devcloudinitial/Modulefile similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/Modulefile rename to tools/devcloud/basebuild/puppet-devcloudinitial/Modulefile diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/grub b/tools/devcloud/basebuild/puppet-devcloudinitial/files/grub similarity index 98% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/grub rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/grub index 88138000e20..34613daf474 100644 --- a/tools/devcloud/puppet/puppet-devcloudinitial/files/grub +++ b/tools/devcloud/basebuild/puppet-devcloudinitial/files/grub @@ -3,7 +3,7 @@ # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' -GRUB_DEFAULT=0 +GRUB_DEFAULT=2 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=2 diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces b/tools/devcloud/basebuild/puppet-devcloudinitial/files/interfaces similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/interfaces diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf b/tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults b/tools/devcloud/basebuild/puppet-devcloudinitial/files/xen-defaults similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/xen-defaults diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/xend b/tools/devcloud/basebuild/puppet-devcloudinitial/files/xend similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/xend rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/xend diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/init.pp b/tools/devcloud/basebuild/puppet-devcloudinitial/init.pp similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/init.pp rename to tools/devcloud/basebuild/puppet-devcloudinitial/init.pp diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp b/tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp similarity index 89% rename from tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp rename to tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp index 79988c6934b..8a0a9d011dc 100644 --- a/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp +++ b/tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp @@ -4,12 +4,12 @@ class puppet-devcloudinitial { ensure => latest, } - package { 'xen-hypervisor-4.1-amd64': + package { 'xen-hypervisor-4.1-i386': ensure => latest, } package { 'xcp-xapi': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => latest, } @@ -38,7 +38,7 @@ class puppet-devcloudinitial { } file { '/etc/default/grub': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'file', source => 'puppet:///modules/puppet-devcloudinitial/grub', group => '0', @@ -53,7 +53,7 @@ class puppet-devcloudinitial { } file { '/usr/share/qemu': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'directory', group => '0', mode => '755', @@ -78,7 +78,7 @@ class puppet-devcloudinitial { } file { '/etc/default/xen': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'file', source => 'puppet:///modules/puppet-devcloudinitial/xen-defaults', group => '0', diff --git a/tools/devcloud/devcloudbox/Vagrantfile b/tools/devcloud/devcloudbox/Vagrantfile new file mode 100644 index 00000000000..6138926bab9 --- /dev/null +++ b/tools/devcloud/devcloudbox/Vagrantfile @@ -0,0 +1,51 @@ +# -*- 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 = "devcloud" + # 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-devcloud" +# puppet.manifest_file = "init.pp" +# puppet.with_ssh = true +# puppet.pp_path = "/etc/puppet" +# puppet.module_path = "puppet-devcloud" +# end + +end diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile b/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile new file mode 100644 index 00000000000..7da4c4cf590 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile @@ -0,0 +1,8 @@ +name 'puppet-devcloud' +version '0.0.1' +source '' +author 'Apache Software Foundation' +license 'Apache 2.0' +summary 'CloudStack DevCloud configuration module' +description 'Devcloud setup module.' +project_page 'http://cloudstack.org' diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save b/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save new file mode 100644 index 00000000000..c556398ca15 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save @@ -0,0 +1,17 @@ +# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012 +*mangle +:PREROUTING ACCEPT [397:23804] +:INPUT ACCEPT [397:23804] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [238:22820] +:POSTROUTING ACCEPT [238:22820] +-A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill +COMMIT +# Completed on Sat Jul 28 03:18:44 2012 +# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012 +*filter +:INPUT ACCEPT [453:27164] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [273:26476] +COMMIT +# Completed on Sat Jul 28 03:18:44 2012 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/init.pp new file mode 100644 index 00000000000..c3922e39d30 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/init.pp @@ -0,0 +1 @@ +include puppet-devcloud diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp new file mode 100644 index 00000000000..b5d75b16425 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp @@ -0,0 +1,32 @@ +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', + } + + exec { "mac=`ifconfig xenbr0 |grep HWaddr |awk '{print $5}'`; /sbin/ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP": + subscribe => Package['ebtables'], + refreshonly => true, + cwd => '/', + } + +} diff --git a/tools/devcloud/puppet/README b/tools/devcloud/puppet/README deleted file mode 100644 index f15f440abd1..00000000000 --- a/tools/devcloud/puppet/README +++ /dev/null @@ -1,12 +0,0 @@ -To use: - -Preconfiguration phase - -- [setup your box in vagrant and place the contents of tools/devcloud/puppet into the box's folder] -- vagrant up; vagrant ssh -- sudo bash -- ln -s /vagrant/puppet-devcloudinitial /etc/puppet/modules/puppet-devcloudinitial -- cd /vagrant -- puppet apply --fsconfig fileserver.conf --debug --verbose -e "include puppet-devcloudinitial" - -Postconfiguration phase - -TODO diff --git a/tools/devcloud/ubuntu_install/README b/tools/devcloud/ubuntu_install/README deleted file mode 100644 index 7432dbc3297..00000000000 --- a/tools/devcloud/ubuntu_install/README +++ /dev/null @@ -1 +0,0 @@ -Nothing in this directory yet, but it will contain the scripts and preconfiguration files to build the basic Ubuntu 12.04 server used in devcloud. diff --git a/tools/devcloud/vagrant/vagrant.pp b/tools/devcloud/vagrant/vagrant.pp deleted file mode 100644 index 1be66262876..00000000000 --- a/tools/devcloud/vagrant/vagrant.pp +++ /dev/null @@ -1,43 +0,0 @@ -group { 'vagranttest': - ensure => 'present', - gid => '5000', -} - -group { 'admin': - ensure => 'present', - gid => '1002', -} - -user { 'vagranttest': - ensure => 'present', - comment => 'vagrant,,,', - gid => '5000', - groups => ['adm', 'cdrom', 'dip', 'plugdev', 'lpadmin', 'sambashare', 'admin'], - home => '/home/vagranttest', - shell => '/bin/bash', - uid => '5000', -} - -file { '/home/vagranttest': - ensure => 'directory', - group => '1002', - mode => '755', - owner => '5000', -} - -file { '/home/vagranttest/.ssh': - ensure => 'directory', - group => '1002', - mode => '775', - owner => '5000', -} - -$auth_key = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" - -file { '/home/vagranttest/.ssh/authorized_keys': - ensure => 'file', - content => $auth_key, - group => '1002', - mode => '664', - owner => '5000', -} diff --git a/tools/devcloud/veewee/postinstall.sh b/tools/devcloud/veewee/postinstall.sh new file mode 100644 index 00000000000..a650501fb61 --- /dev/null +++ b/tools/devcloud/veewee/postinstall.sh @@ -0,0 +1,42 @@ +# 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. + +apt-get -y update +apt-get -y upgrade +apt-get -y install vim +apt-get -y install ruby +apt-get -y install rubygems +apt-get -y install puppet +apt-get clean + +# Setup sudo to allow no-password sudo for "admin" +groupadd -r admin +usermod -a -G admin devcloud +sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers +sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers + +mkdir /home/devcloud/.ssh +chmod 700 /home/devcloud/.ssh +cd /home/devcloud/.ssh +wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys +chmod 600 /home/devcloud/.ssh/authorized_keys +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 +