Skip to content

Commit

Permalink
Merge pull request jedi4ever#25 from splaice/master.
Browse files Browse the repository at this point in the history
Fedora 14 Templates + Enable/Disable HW Virt Extenstions + Create Validation Dir
  • Loading branch information
jedi4ever committed May 1, 2011
2 parents 9a1d37f + 50cbad8 commit 4e4fa35
Show file tree
Hide file tree
Showing 13 changed files with 437 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/veewee/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def self.setenv(env)
@veewee_dir=env[:veewee_dir]
@definition_dir=env[:definition_dir]
@template_dir=env[:template_dir]
@validation_dir=env[:veewee_dir] + 'validation'
@box_dir=env[:box_dir]
@iso_dir=env[:iso_dir]
@tmp_dir=env[:tmp_dir]
Expand All @@ -30,7 +31,7 @@ def self.setenv(env)
def self.declare(options)
defaults={
:cpu_count => '1', :memory_size=> '256',
:disk_size => '10240', :disk_format => 'VDI', :hostiocache => 'off' ,
:disk_size => '10240', :disk_format => 'VDI', :hostiocache => 'off' , :use_hw_virt_ext => 'on', :use_pae => 'off',
:os_type_id => 'Ubuntu',
:iso_file => "ubuntu-10.10-server-i386.iso", :iso_src => "", :iso_md5 => "", :iso_download_timeout => 1000,
:boot_wait => "10", :boot_cmd_sequence => [ "boot"],
Expand Down Expand Up @@ -488,16 +489,26 @@ def self.create_vm(boxname,force=false)
#TODO One day ruby-virtualbox will be able to handle this creation
#Box does not exist, we can start to create it

command="#{@vboxcmd} createvm --name '#{boxname}' --ostype '#{@definition[:os_type_id]}' --register"
command="#{@vboxcmd} createvm --name '#{boxname}' --ostype '#{@definition[:os_type_id]}' --register"

#Exec and system stop the execution here
Veewee::Shell.execute("#{command}")

# Modify the vm to enable or disable hw virtualization extensions
command="#{@vboxcmd} modifyvm #{boxname} --hwvirtex #{@definition[:use_hw_virt_ext]} --pae #{@definition[:use_pae]}"

#Exec and system stop the execution here
Veewee::Shell.execute("#{command}")

#Set a shared folder for validation
command="#{@vboxcmd} sharedfolder add '#{boxname}' --name 'veewee-validation' --hostpath '#{File.expand_path(@veewee_dir)}/validation' --automount"
if !File.exists?(@validation_dir)
FileUtils.mkdir(File.expand_path(@validation_dir))
end

command="#{@vboxcmd} sharedfolder add '#{boxname}' --name 'veewee-validation' --hostpath '#{File.expand_path(@validation_dir)}' --automount"

Veewee::Shell.execute("#{command}")

end

vm=VirtualBox::VM.find(boxname)
Expand Down
16 changes: 16 additions & 0 deletions templates/Fedora-14-amd64-netboot/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '384',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :use_hw_virt_ext => 'on',
:os_type_id => 'Fedora',
:iso_file => "Fedora-14-x86_64-netinst.iso",
:iso_src => "http://mirror.uoregon.edu/fedora/linux/releases/14/Fedora/x86_64/iso/Fedora-14-x86_64-netinst.iso",
:iso_md5 => "acd25fc1470f2497cf2a2a245adbfe1e",
:iso_download_timeout => 1000,
:boot_wait => "10", :boot_cmd_sequence => [ '<Tab> linux text ks=http://%IP%:%PORT%/ks.cfg<Enter><Enter>' ],
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
:ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/sbin/halt -h -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
})
39 changes: 39 additions & 0 deletions templates/Fedora-14-amd64-netboot/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Kickstart file automatically generated by anaconda.

install
url --url=http://mirrors.cat.pdx.edu/fedora/linux/releases/14/Fedora/x86_64/os/
lang en_US.UTF-8
keyboard us
#xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$n/NGsk5H2aiBMXL4$r/oPkJtB5rasvQHPo9AvIJBe6sNVlQbpZxvTRMN7.qZk/Sn9u2qZ0XgNxflUvK20y7OIWdr/vv7MED6gzkBiH0
firewall --enabled --trust eth0 --ssh
selinux --enforcing
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda --append="nomodeset rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda --initlabel
part /boot --fstype=ext4 --size=500 --ondisk=sda
part pv.2 --size=0 --grow --size=500
volgroup vg_main --pesize=32768 pv.2
logvol swap --fstype=swap --name=lv_swap --vgname=vg_main --size=528 --grow --maxsize=1056
logvol / --fstype=ext4 --name=lv_root --vgname=vg_main --size=1024 --grow
repo --name="Fedora 14 - x86_64" --baseurl=http://mirrors.xmission.com/fedora/releases/14/Everything/x86_64/os/ --cost=1000
repo --name="Fedora 14 - x86_64 - Updates" --baseurl=http://mirror.pnl.gov/fedora/linux/updates/14/x86_64/ --cost=1000
reboot

%packages
@core
@online-docs
%end

%post
/usr/sbin/groupadd vagrant
/usr/sbin/useradd vagrant -g vagrant -G wheel
echo "vagrant"|passwd --stdin vagrant
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
%end
50 changes: 50 additions & 0 deletions templates/Fedora-14-amd64-netboot/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
#kernel source is needed for vbox additions

yum -y install gcc bzip2 make patch kernel-devel-`uname -r`

#yum -y update
#yum -y upgrade

yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel

yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts


yum -y clean all

#Installing ruby
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
./ruby-enterprise-1.8.7-2010.02/installer -a /opt/ruby --no-dev-docs --dont-install-useful-gems
echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/rubyenterprise.sh
rm -rf ./ruby-enterprise-1.8.7-2010.02/
rm ruby-enterprise-1.8.7-2010.02.tar.gz

#Installing chef & Puppet
/opt/ruby/bin/gem install chef --no-ri --no-rdoc
/opt/ruby/bin/gem install puppet --no-ri --no-rdoc

#Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh

#Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt

rm VBoxGuestAdditions_$VBOX_VERSION.iso


sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers

#poweroff -h

exit
16 changes: 16 additions & 0 deletions templates/Fedora-14-amd64/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '384',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :use_hw_virt_ext => 'on',
:os_type_id => 'Fedora',
:iso_file => "Fedora-14-x86_64-DVD.iso",
:iso_src => "http://mirror.uoregon.edu/fedora/linux/releases/14/Fedora/x86_64/iso/Fedora-14-x86_64-DVD.iso",
:iso_md5 => "381d7336c6d1685cbb4eae49cdef2247",
:iso_download_timeout => 1000,
:boot_wait => "10", :boot_cmd_sequence => [ '<Tab> linux text ks=http://%IP%:%PORT%/ks.cfg<Enter><Enter>' ],
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
:ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/sbin/halt -h -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
})
40 changes: 40 additions & 0 deletions templates/Fedora-14-amd64/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Kickstart file automatically generated by anaconda.

install
cdrom
lang en_US.UTF-8
keyboard us
#xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$n/NGsk5H2aiBMXL4$r/oPkJtB5rasvQHPo9AvIJBe6sNVlQbpZxvTRMN7.qZk/Sn9u2qZ0XgNxflUvK20y7OIWdr/vv7MED6gzkBiH0
firewall --enabled --trust eth0 --ssh
selinux --enforcing
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda --append="nomodeset rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda --initlabel
part /boot --fstype=ext4 --size=500 --ondisk=sda
part pv.2 --size=0 --grow --size=500
volgroup vg_main --pesize=32768 pv.2
logvol swap --fstype=swap --name=lv_swap --vgname=vg_main --size=528 --grow --maxsize=1056
logvol / --fstype=ext4 --name=lv_root --vgname=vg_main --size=1024 --grow
# We leave the repo commands out so that we install from the iso
#repo --name="Fedora 14 - x86_64" --baseurl=http://mirrors.xmission.com/fedora/releases/14/Everything/x86_64/os/ --cost=1000
#repo --name="Fedora 14 - x86_64 - Updates" --baseurl=http://mirror.pnl.gov/fedora/linux/updates/14/x86_64/ --cost=1000
reboot

%packages
@core
@online-docs
%end

%post
/usr/sbin/groupadd vagrant
/usr/sbin/useradd vagrant -g vagrant -G wheel
echo "vagrant"|passwd --stdin vagrant
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
%end
50 changes: 50 additions & 0 deletions templates/Fedora-14-amd64/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
#kernel source is needed for vbox additions

yum -y install gcc bzip2 make patch kernel-devel-`uname -r`

#yum -y update
#yum -y upgrade

yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel

yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts


yum -y clean all

#Installing ruby
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
./ruby-enterprise-1.8.7-2010.02/installer -a /opt/ruby --no-dev-docs --dont-install-useful-gems
echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/rubyenterprise.sh
rm -rf ./ruby-enterprise-1.8.7-2010.02/
rm ruby-enterprise-1.8.7-2010.02.tar.gz

#Installing chef & Puppet
/opt/ruby/bin/gem install chef --no-ri --no-rdoc
/opt/ruby/bin/gem install puppet --no-ri --no-rdoc

#Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh

#Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt

rm VBoxGuestAdditions_$VBOX_VERSION.iso


sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers

#poweroff -h

exit
16 changes: 16 additions & 0 deletions templates/Fedora-14-i386-netboot/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '384',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :use_hw_virt_ext => 'on',
:os_type_id => 'Fedora',
:iso_file => "Fedora-14-i386-netinst.iso",
:iso_src => "http://www.gtlib.gatech.edu/pub/fedora.redhat/linux//releases/14/Fedora/i386/iso/Fedora-14-i386-netinst.iso",
:iso_md5 => "59d2490d7bf73a6c8a80d9a790f17184",
:iso_download_timeout => 1000,
:boot_wait => "10", :boot_cmd_sequence => [ '<Tab> linux text ks=http://%IP%:%PORT%/ks.cfg<Enter><Enter>' ],
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
:ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/sbin/halt -h -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
})
39 changes: 39 additions & 0 deletions templates/Fedora-14-i386-netboot/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Kickstart file automatically generated by anaconda.

install
url --url=http://mirrors.cat.pdx.edu/fedora/linux/releases/14/Fedora/i386/os/
lang en_US.UTF-8
keyboard us
#xconfig --card "VMWare" --videoram 16384 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw --iscrypted $6$n/NGsk5H2aiBMXL4$r/oPkJtB5rasvQHPo9AvIJBe6sNVlQbpZxvTRMN7.qZk/Sn9u2qZ0XgNxflUvK20y7OIWdr/vv7MED6gzkBiH0
firewall --enabled --trust eth0 --ssh
selinux --enforcing
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
timezone --utc America/Los_Angeles
bootloader --location=mbr --driveorder=sda --append="nomodeset rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --drives=sda --initlabel
part /boot --fstype=ext4 --size=500 --ondisk=sda
part pv.2 --size=0 --grow --size=500
volgroup vg_main --pesize=32768 pv.2
logvol swap --fstype=swap --name=lv_swap --vgname=vg_main --size=528 --grow --maxsize=1056
logvol / --fstype=ext4 --name=lv_root --vgname=vg_main --size=1024 --grow
repo --name="Fedora 14 - i386" --baseurl=http://mirrors.xmission.com/fedora/releases/14/Everything/i386/os/ --cost=1000
repo --name="Fedora 14 - i386 - Updates" --baseurl=http://mirror.pnl.gov/fedora/linux/updates/14/i386/ --cost=1000
reboot

%packages
@core
@online-docs
%end

%post
/usr/sbin/groupadd vagrant
/usr/sbin/useradd vagrant -g vagrant -G wheel
echo "vagrant"|passwd --stdin vagrant
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
%end
50 changes: 50 additions & 0 deletions templates/Fedora-14-i386-netboot/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#http://chrisadams.me.uk/2010/05/10/setting-up-a-centos-base-box-for-development-and-testing-with-vagrant/
#kernel source is needed for vbox additions

yum -y install gcc bzip2 make patch kernel-devel-`uname -r`

#yum -y update
#yum -y upgrade

yum -y install gcc-c++ zlib-devel openssl-devel readline-devel sqlite3-devel

yum -y erase wireless-tools gtk2 libX11 hicolor-icon-theme avahi freetype bitstream-vera-fonts


yum -y clean all

#Installing ruby
wget http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz
tar xzvf ruby-enterprise-1.8.7-2010.02.tar.gz
./ruby-enterprise-1.8.7-2010.02/installer -a /opt/ruby --no-dev-docs --dont-install-useful-gems
echo 'PATH=$PATH:/opt/ruby/bin/'> /etc/profile.d/rubyenterprise.sh
rm -rf ./ruby-enterprise-1.8.7-2010.02/
rm ruby-enterprise-1.8.7-2010.02.tar.gz

#Installing chef & Puppet
/opt/ruby/bin/gem install chef --no-ri --no-rdoc
/opt/ruby/bin/gem install puppet --no-ri --no-rdoc

#Installing vagrant keys
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
cd /home/vagrant/.ssh
wget --no-check-certificate 'http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub' -O authorized_keys
chown -R vagrant /home/vagrant/.ssh

#Installing the virtualbox guest additions
VBOX_VERSION=$(cat /home/vagrant/.vbox_version)
cd /tmp
wget http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso
mount -o loop VBoxGuestAdditions_$VBOX_VERSION.iso /mnt
sh /mnt/VBoxLinuxAdditions.run
umount /mnt

rm VBoxGuestAdditions_$VBOX_VERSION.iso


sed -i "s/^.*requiretty/#Defaults requiretty/" /etc/sudoers

#poweroff -h

exit
16 changes: 16 additions & 0 deletions templates/Fedora-14-i386/definition.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Veewee::Session.declare({
:cpu_count => '1', :memory_size=> '384',
:disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off', :use_hw_virt_ext => 'on',
:os_type_id => 'Fedora',
:iso_file => "Fedora-14-i386-DVD.iso",
:iso_src => "http://mirror.uoregon.edu/fedora/linux/releases/14/Fedora/i386/iso/Fedora-14-i386-DVD.iso",
:iso_md5 => "1cc67641506d2f931d669b8d3528dded",
:iso_download_timeout => 1000,
:boot_wait => "10", :boot_cmd_sequence => [ '<Tab> linux text ks=http://%IP%:%PORT%/ks.cfg<Enter><Enter>' ],
:kickstart_port => "7122", :kickstart_timeout => 10000, :kickstart_file => "ks.cfg",
:ssh_login_timeout => "100", :ssh_user => "vagrant", :ssh_password => "vagrant", :ssh_key => "",
:ssh_host_port => "7222", :ssh_guest_port => "22",
:sudo_cmd => "echo '%p'|sudo -S sh '%f'",
:shutdown_cmd => "/sbin/halt -h -p",
:postinstall_files => [ "postinstall.sh"], :postinstall_timeout => 10000
})
Loading

0 comments on commit 4e4fa35

Please sign in to comment.