From bb4dbf0b4d160b1c367d8b2edaa56e523f3125f5 Mon Sep 17 00:00:00 2001 From: "gaurav.kumar" Date: Fri, 8 Apr 2016 18:47:49 -0700 Subject: [PATCH 1/2] Added ubuntu-12.04.5 amd and i386 templates --- templates/ubuntu-12.04.5-server-amd64/apt.sh | 8 +++ .../ubuntu-12.04.5-server-amd64/build_time.sh | 1 + templates/ubuntu-12.04.5-server-amd64/chef.sh | 3 + .../ubuntu-12.04.5-server-amd64/cleanup.sh | 16 +++++ .../ubuntu-12.04.5-server-amd64/definition.rb | 45 ++++++++++++++ .../ubuntu-12.04.5-server-amd64/preseed.cfg | 61 +++++++++++++++++++ .../ubuntu-12.04.5-server-amd64/puppet.sh | 4 ++ templates/ubuntu-12.04.5-server-amd64/ruby.sh | 25 ++++++++ templates/ubuntu-12.04.5-server-amd64/sudo.sh | 5 ++ .../ubuntu-12.04.5-server-amd64/vagrant.sh | 6 ++ templates/ubuntu-12.04.5-server-amd64/vbox.sh | 18 ++++++ templates/ubuntu-12.04.5-server-i386/apt.sh | 8 +++ .../ubuntu-12.04.5-server-i386/build_time.sh | 1 + templates/ubuntu-12.04.5-server-i386/chef.sh | 3 + .../ubuntu-12.04.5-server-i386/cleanup.sh | 16 +++++ .../ubuntu-12.04.5-server-i386/definition.rb | 45 ++++++++++++++ .../ubuntu-12.04.5-server-i386/preseed.cfg | 61 +++++++++++++++++++ .../ubuntu-12.04.5-server-i386/puppet.sh | 4 ++ templates/ubuntu-12.04.5-server-i386/ruby.sh | 25 ++++++++ templates/ubuntu-12.04.5-server-i386/sudo.sh | 5 ++ .../ubuntu-12.04.5-server-i386/vagrant.sh | 6 ++ templates/ubuntu-12.04.5-server-i386/vbox.sh | 18 ++++++ 22 files changed, 384 insertions(+) create mode 100644 templates/ubuntu-12.04.5-server-amd64/apt.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/build_time.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/chef.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/cleanup.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/definition.rb create mode 100644 templates/ubuntu-12.04.5-server-amd64/preseed.cfg create mode 100644 templates/ubuntu-12.04.5-server-amd64/puppet.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/ruby.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/sudo.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/vagrant.sh create mode 100644 templates/ubuntu-12.04.5-server-amd64/vbox.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/apt.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/build_time.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/chef.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/cleanup.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/definition.rb create mode 100644 templates/ubuntu-12.04.5-server-i386/preseed.cfg create mode 100644 templates/ubuntu-12.04.5-server-i386/puppet.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/ruby.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/sudo.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/vagrant.sh create mode 100644 templates/ubuntu-12.04.5-server-i386/vbox.sh diff --git a/templates/ubuntu-12.04.5-server-amd64/apt.sh b/templates/ubuntu-12.04.5-server-amd64/apt.sh new file mode 100644 index 00000000..e6530202 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/apt.sh @@ -0,0 +1,8 @@ +apt-get -y update +apt-get -y upgrade +apt-get -y install linux-headers-$(uname -r) build-essential +apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev +apt-get -y install vim +apt-get -y install dkms +apt-get -y install nfs-common +apt-get -y install rsync diff --git a/templates/ubuntu-12.04.5-server-amd64/build_time.sh b/templates/ubuntu-12.04.5-server-amd64/build_time.sh new file mode 100644 index 00000000..c9b2c6e8 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/build_time.sh @@ -0,0 +1 @@ +date > /etc/vagrant_box_build_time diff --git a/templates/ubuntu-12.04.5-server-amd64/chef.sh b/templates/ubuntu-12.04.5-server-amd64/chef.sh new file mode 100644 index 00000000..a0a9e3b4 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/chef.sh @@ -0,0 +1,3 @@ +GEM=/opt/ruby/bin/gem + +$GEM install chef --no-ri --no-rdoc diff --git a/templates/ubuntu-12.04.5-server-amd64/cleanup.sh b/templates/ubuntu-12.04.5-server-amd64/cleanup.sh new file mode 100644 index 00000000..33f8d6ec --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/cleanup.sh @@ -0,0 +1,16 @@ +apt-get -y autoremove + +dd if=/dev/zero of=/EMPTY bs=1M +rm -f /EMPTY + +echo "cleaning up dhcp leases" +rm /var/lib/dhcp/* + +echo "cleaning up udev rules" +rm /etc/udev/rules.d/70-persistent-net.rules +mkdir /etc/udev/rules.d/70-persistent-net.rules +rm -rf /dev/.udev/ +rm /lib/udev/rules.d/75-persistent-net-generator.rules + +echo "pre-up sleep 2" >> /etc/network/interfaces +exit diff --git a/templates/ubuntu-12.04.5-server-amd64/definition.rb b/templates/ubuntu-12.04.5-server-amd64/definition.rb new file mode 100644 index 00000000..feecfb23 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/definition.rb @@ -0,0 +1,45 @@ +Veewee::Session.declare({ + :cpu_count => '1', + :memory_size => '1024', + :disk_size => '65536', + :disk_format => 'VDI', + :hostiocache => 'off', + :os_type_id => 'Ubuntu_64', + :iso_file => "ubuntu-12.04.5-server-amd64.iso", + :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso", + :iso_md5 => "e83adb9af4ec0a039e6a5c6e145a34de", + :iso_download_timeout => "1000", + :boot_wait => "4", + :boot_cmd_sequence => [ + '', + '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ', + 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ', + 'hostname=%NAME% ', + 'fb=false debconf/frontend=noninteractive ', + 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ', + 'initrd=/install/initrd.gz -- ' +], + :kickstart_port => "7122", + :kickstart_timeout => "300", + :kickstart_file => "preseed.cfg", + :ssh_login_timeout => "10000", + :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 => "shutdown -P now", + :postinstall_files => [ + "build_time.sh", + "apt.sh", + "vbox.sh", + "sudo.sh", + "ruby.sh", + "chef.sh", + "puppet.sh", + "vagrant.sh", + "cleanup.sh" + ], + :postinstall_timeout => "10000" +}) diff --git a/templates/ubuntu-12.04.5-server-amd64/preseed.cfg b/templates/ubuntu-12.04.5-server-amd64/preseed.cfg new file mode 100644 index 00000000..2ab89c1b --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/preseed.cfg @@ -0,0 +1,61 @@ +## Options to set on the command line +d-i debian-installer/locale string en_US.utf8 +d-i console-setup/ask_detect boolean false +d-i console-setup/layout string us + +d-i netcfg/get_hostname string unassigned-hostname +d-i netcfg/get_domain string unassigned-domain + +d-i time/zone string UTC +d-i clock-setup/utc-auto boolean true +d-i clock-setup/utc boolean true + +d-i kbd-chooser/method select American English + +d-i netcfg/wireless_wep string + +d-i base-installer/kernel/override-image string linux-server + +d-i debconf debconf/frontend select Noninteractive + +d-i pkgsel/install-language-support boolean false +tasksel tasksel/first multiselect standard, ubuntu-server + +d-i partman-auto/method string lvm + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-auto/choose_recipe select atomic + +d-i partman/confirm_write_new_label boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true + +# Write the changes to disks and configure LVM? +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-auto-lvm/guided_size string max + +# Default user +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant +d-i user-setup/encrypt-home boolean false +d-i user-setup/allow-password-weak boolean true + +# Minimum packages (see postinstall.sh) +d-i pkgsel/include string openssh-server ntp + +# Upgrade packages after debootstrap? (none, safe-upgrade, full-upgrade) +# (note: set to none for speed) +d-i pkgsel/upgrade select none + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i finish-install/reboot_in_progress note + +d-i pkgsel/update-policy select none + +choose-mirror-bin mirror/http/proxy string diff --git a/templates/ubuntu-12.04.5-server-amd64/puppet.sh b/templates/ubuntu-12.04.5-server-amd64/puppet.sh new file mode 100644 index 00000000..d9c68221 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/puppet.sh @@ -0,0 +1,4 @@ +GEM=/opt/ruby/bin/gem + +adduser --system --group --home /var/lib/puppet puppet +$GEM install puppet --no-ri --no-rdoc diff --git a/templates/ubuntu-12.04.5-server-amd64/ruby.sh b/templates/ubuntu-12.04.5-server-amd64/ruby.sh new file mode 100644 index 00000000..0cb1e353 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/ruby.sh @@ -0,0 +1,25 @@ +apt-get -y install libyaml-0-2 +RUBY_VERSION=1.9.3-p392 + +cd /tmp + +wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-$RUBY_VERSION.tar.gz +tar xvzf ruby-$RUBY_VERSION.tar.gz +cd ruby-$RUBY_VERSION +./configure --prefix=/opt/ruby +make +make install +cd .. +rm -rf ruby-$RUBY_VERSION +rm ruby-$RUBY_VERSION.tar.gz + +RUBYGEMS_VERSION=2.0.3 +wget http://production.cf.rubygems.org/rubygems/rubygems-$RUBYGEMS_VERSION.tgz +tar xzf rubygems-$RUBYGEMS_VERSION.tgz +cd rubygems-$RUBYGEMS_VERSION +/opt/ruby/bin/ruby setup.rb +cd .. +rm -rf rubygems-$RUBYGEMS_VERSION +rm rubygems-$RUBYGEMS_VERSION.tgz + +echo 'PATH=$PATH:/opt/ruby/bin/' > /etc/profile.d/vagrantruby.sh diff --git a/templates/ubuntu-12.04.5-server-amd64/sudo.sh b/templates/ubuntu-12.04.5-server-amd64/sudo.sh new file mode 100644 index 00000000..65ccf166 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/sudo.sh @@ -0,0 +1,5 @@ +groupadd -r admin +usermod -a -G admin vagrant +cp /etc/sudoers /etc/sudoers.orig +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 diff --git a/templates/ubuntu-12.04.5-server-amd64/vagrant.sh b/templates/ubuntu-12.04.5-server-amd64/vagrant.sh new file mode 100644 index 00000000..10efd34b --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/vagrant.sh @@ -0,0 +1,6 @@ +mkdir /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh +cd /home/vagrant/.ssh +wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys +chmod 600 /home/vagrant/.ssh/authorized_keys +chown -R vagrant /home/vagrant/.ssh diff --git a/templates/ubuntu-12.04.5-server-amd64/vbox.sh b/templates/ubuntu-12.04.5-server-amd64/vbox.sh new file mode 100644 index 00000000..a05dd658 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/vbox.sh @@ -0,0 +1,18 @@ +# Without libdbus virtualbox would not start automatically after compile +apt-get -y install --no-install-recommends libdbus-1-3 + +# Remove existing VirtualBox guest additions +/etc/init.d/virtualbox-ose-guest-utils stop +rmmod vboxguest +aptitude -y purge virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms virtualbox-ose-guest-utils +aptitude -y install dkms + +# Install the VirtualBox guest additions +VBOX_VERSION=$(cat /home/vagrant/.vbox_version) +VBOX_ISO=VBoxGuestAdditions_$VBOX_VERSION.iso +mount -o loop $VBOX_ISO /mnt +yes|sh /mnt/VBoxLinuxAdditions.run +umount /mnt + +# Cleanup +rm $VBOX_ISO diff --git a/templates/ubuntu-12.04.5-server-i386/apt.sh b/templates/ubuntu-12.04.5-server-i386/apt.sh new file mode 100644 index 00000000..e6530202 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/apt.sh @@ -0,0 +1,8 @@ +apt-get -y update +apt-get -y upgrade +apt-get -y install linux-headers-$(uname -r) build-essential +apt-get -y install zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev +apt-get -y install vim +apt-get -y install dkms +apt-get -y install nfs-common +apt-get -y install rsync diff --git a/templates/ubuntu-12.04.5-server-i386/build_time.sh b/templates/ubuntu-12.04.5-server-i386/build_time.sh new file mode 100644 index 00000000..c9b2c6e8 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/build_time.sh @@ -0,0 +1 @@ +date > /etc/vagrant_box_build_time diff --git a/templates/ubuntu-12.04.5-server-i386/chef.sh b/templates/ubuntu-12.04.5-server-i386/chef.sh new file mode 100644 index 00000000..a0a9e3b4 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/chef.sh @@ -0,0 +1,3 @@ +GEM=/opt/ruby/bin/gem + +$GEM install chef --no-ri --no-rdoc diff --git a/templates/ubuntu-12.04.5-server-i386/cleanup.sh b/templates/ubuntu-12.04.5-server-i386/cleanup.sh new file mode 100644 index 00000000..33f8d6ec --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/cleanup.sh @@ -0,0 +1,16 @@ +apt-get -y autoremove + +dd if=/dev/zero of=/EMPTY bs=1M +rm -f /EMPTY + +echo "cleaning up dhcp leases" +rm /var/lib/dhcp/* + +echo "cleaning up udev rules" +rm /etc/udev/rules.d/70-persistent-net.rules +mkdir /etc/udev/rules.d/70-persistent-net.rules +rm -rf /dev/.udev/ +rm /lib/udev/rules.d/75-persistent-net-generator.rules + +echo "pre-up sleep 2" >> /etc/network/interfaces +exit diff --git a/templates/ubuntu-12.04.5-server-i386/definition.rb b/templates/ubuntu-12.04.5-server-i386/definition.rb new file mode 100644 index 00000000..696267c7 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/definition.rb @@ -0,0 +1,45 @@ +Veewee::Session.declare({ + :cpu_count => '1', + :memory_size => '1024', + :disk_size => '65536', + :disk_format => 'VDI', + :hostiocache => 'off', + :os_type_id => 'Ubuntu', + :iso_file => "ubuntu-12.04.5-server-i386.iso", + :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-i386.iso", + :iso_md5 => "0081e57fb8c7e4094fb9767384f087c6", + :iso_download_timeout => "1000", + :boot_wait => "4", + :boot_cmd_sequence => [ + '', + '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ', + 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ', + 'hostname=%NAME% ', + 'fb=false debconf/frontend=noninteractive ', + 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ', + 'initrd=/install/initrd.gz -- ' +], + :kickstart_port => "7122", + :kickstart_timeout => "300", + :kickstart_file => "preseed.cfg", + :ssh_login_timeout => "10000", + :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 => "shutdown -P now", + :postinstall_files => [ + "build_time.sh", + "apt.sh", + "vbox.sh", + "sudo.sh", + "ruby.sh", + "chef.sh", + "puppet.sh", + "vagrant.sh", + "cleanup.sh" + ], + :postinstall_timeout => "10000" +}) diff --git a/templates/ubuntu-12.04.5-server-i386/preseed.cfg b/templates/ubuntu-12.04.5-server-i386/preseed.cfg new file mode 100644 index 00000000..2ab89c1b --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/preseed.cfg @@ -0,0 +1,61 @@ +## Options to set on the command line +d-i debian-installer/locale string en_US.utf8 +d-i console-setup/ask_detect boolean false +d-i console-setup/layout string us + +d-i netcfg/get_hostname string unassigned-hostname +d-i netcfg/get_domain string unassigned-domain + +d-i time/zone string UTC +d-i clock-setup/utc-auto boolean true +d-i clock-setup/utc boolean true + +d-i kbd-chooser/method select American English + +d-i netcfg/wireless_wep string + +d-i base-installer/kernel/override-image string linux-server + +d-i debconf debconf/frontend select Noninteractive + +d-i pkgsel/install-language-support boolean false +tasksel tasksel/first multiselect standard, ubuntu-server + +d-i partman-auto/method string lvm + +d-i partman-lvm/confirm boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-auto/choose_recipe select atomic + +d-i partman/confirm_write_new_label boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true + +# Write the changes to disks and configure LVM? +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-auto-lvm/guided_size string max + +# Default user +d-i passwd/user-fullname string vagrant +d-i passwd/username string vagrant +d-i passwd/user-password password vagrant +d-i passwd/user-password-again password vagrant +d-i user-setup/encrypt-home boolean false +d-i user-setup/allow-password-weak boolean true + +# Minimum packages (see postinstall.sh) +d-i pkgsel/include string openssh-server ntp + +# Upgrade packages after debootstrap? (none, safe-upgrade, full-upgrade) +# (note: set to none for speed) +d-i pkgsel/upgrade select none + +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i finish-install/reboot_in_progress note + +d-i pkgsel/update-policy select none + +choose-mirror-bin mirror/http/proxy string diff --git a/templates/ubuntu-12.04.5-server-i386/puppet.sh b/templates/ubuntu-12.04.5-server-i386/puppet.sh new file mode 100644 index 00000000..d9c68221 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/puppet.sh @@ -0,0 +1,4 @@ +GEM=/opt/ruby/bin/gem + +adduser --system --group --home /var/lib/puppet puppet +$GEM install puppet --no-ri --no-rdoc diff --git a/templates/ubuntu-12.04.5-server-i386/ruby.sh b/templates/ubuntu-12.04.5-server-i386/ruby.sh new file mode 100644 index 00000000..0cb1e353 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/ruby.sh @@ -0,0 +1,25 @@ +apt-get -y install libyaml-0-2 +RUBY_VERSION=1.9.3-p392 + +cd /tmp + +wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-$RUBY_VERSION.tar.gz +tar xvzf ruby-$RUBY_VERSION.tar.gz +cd ruby-$RUBY_VERSION +./configure --prefix=/opt/ruby +make +make install +cd .. +rm -rf ruby-$RUBY_VERSION +rm ruby-$RUBY_VERSION.tar.gz + +RUBYGEMS_VERSION=2.0.3 +wget http://production.cf.rubygems.org/rubygems/rubygems-$RUBYGEMS_VERSION.tgz +tar xzf rubygems-$RUBYGEMS_VERSION.tgz +cd rubygems-$RUBYGEMS_VERSION +/opt/ruby/bin/ruby setup.rb +cd .. +rm -rf rubygems-$RUBYGEMS_VERSION +rm rubygems-$RUBYGEMS_VERSION.tgz + +echo 'PATH=$PATH:/opt/ruby/bin/' > /etc/profile.d/vagrantruby.sh diff --git a/templates/ubuntu-12.04.5-server-i386/sudo.sh b/templates/ubuntu-12.04.5-server-i386/sudo.sh new file mode 100644 index 00000000..65ccf166 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/sudo.sh @@ -0,0 +1,5 @@ +groupadd -r admin +usermod -a -G admin vagrant +cp /etc/sudoers /etc/sudoers.orig +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 diff --git a/templates/ubuntu-12.04.5-server-i386/vagrant.sh b/templates/ubuntu-12.04.5-server-i386/vagrant.sh new file mode 100644 index 00000000..10efd34b --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/vagrant.sh @@ -0,0 +1,6 @@ +mkdir /home/vagrant/.ssh +chmod 700 /home/vagrant/.ssh +cd /home/vagrant/.ssh +wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys +chmod 600 /home/vagrant/.ssh/authorized_keys +chown -R vagrant /home/vagrant/.ssh diff --git a/templates/ubuntu-12.04.5-server-i386/vbox.sh b/templates/ubuntu-12.04.5-server-i386/vbox.sh new file mode 100644 index 00000000..a05dd658 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/vbox.sh @@ -0,0 +1,18 @@ +# Without libdbus virtualbox would not start automatically after compile +apt-get -y install --no-install-recommends libdbus-1-3 + +# Remove existing VirtualBox guest additions +/etc/init.d/virtualbox-ose-guest-utils stop +rmmod vboxguest +aptitude -y purge virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms virtualbox-ose-guest-utils +aptitude -y install dkms + +# Install the VirtualBox guest additions +VBOX_VERSION=$(cat /home/vagrant/.vbox_version) +VBOX_ISO=VBoxGuestAdditions_$VBOX_VERSION.iso +mount -o loop $VBOX_ISO /mnt +yes|sh /mnt/VBoxLinuxAdditions.run +umount /mnt + +# Cleanup +rm $VBOX_ISO From ec36315c914c58eb053cc64373336a03b91403d5 Mon Sep 17 00:00:00 2001 From: "gaurav.kumar" Date: Mon, 11 Apr 2016 17:54:41 -0700 Subject: [PATCH 2/2] Moved configuration to *.yml file --- .../ubuntu-12.04.5-server-amd64/definition.rb | 50 ++----------------- .../definition.yml | 41 +++++++++++++++ .../ubuntu-12.04.5-server-i386/definition.rb | 50 ++----------------- .../ubuntu-12.04.5-server-i386/definition.yml | 41 +++++++++++++++ 4 files changed, 92 insertions(+), 90 deletions(-) create mode 100644 templates/ubuntu-12.04.5-server-amd64/definition.yml create mode 100644 templates/ubuntu-12.04.5-server-i386/definition.yml diff --git a/templates/ubuntu-12.04.5-server-amd64/definition.rb b/templates/ubuntu-12.04.5-server-amd64/definition.rb index feecfb23..fd3f4548 100644 --- a/templates/ubuntu-12.04.5-server-amd64/definition.rb +++ b/templates/ubuntu-12.04.5-server-amd64/definition.rb @@ -1,45 +1,5 @@ -Veewee::Session.declare({ - :cpu_count => '1', - :memory_size => '1024', - :disk_size => '65536', - :disk_format => 'VDI', - :hostiocache => 'off', - :os_type_id => 'Ubuntu_64', - :iso_file => "ubuntu-12.04.5-server-amd64.iso", - :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso", - :iso_md5 => "e83adb9af4ec0a039e6a5c6e145a34de", - :iso_download_timeout => "1000", - :boot_wait => "4", - :boot_cmd_sequence => [ - '', - '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ', - 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ', - 'hostname=%NAME% ', - 'fb=false debconf/frontend=noninteractive ', - 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ', - 'initrd=/install/initrd.gz -- ' -], - :kickstart_port => "7122", - :kickstart_timeout => "300", - :kickstart_file => "preseed.cfg", - :ssh_login_timeout => "10000", - :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 => "shutdown -P now", - :postinstall_files => [ - "build_time.sh", - "apt.sh", - "vbox.sh", - "sudo.sh", - "ruby.sh", - "chef.sh", - "puppet.sh", - "vagrant.sh", - "cleanup.sh" - ], - :postinstall_timeout => "10000" -}) +# +# Changed ubuntu-12.04.5-server-amd64 to *.yml configuration in this directory +# + +Veewee::Definition.declare_yaml('definition.yml') diff --git a/templates/ubuntu-12.04.5-server-amd64/definition.yml b/templates/ubuntu-12.04.5-server-amd64/definition.yml new file mode 100644 index 00000000..7ed8544a --- /dev/null +++ b/templates/ubuntu-12.04.5-server-amd64/definition.yml @@ -0,0 +1,41 @@ +:cpu_count: '1' +:memory_size: '1024' +:disk_size: '65536' +:disk_format: 'VDI' +:hostiocache: 'off' +:os_type_id: 'Ubuntu_64' +:iso_file: "ubuntu-12.04.5-server-amd64.iso" +:iso_src: "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-amd64.iso" +:iso_md5: "769474248a3897f4865817446f9a4a53" +:iso_download_timeout: "1000" +:boot_wait: "4" +:boot_cmd_sequence: + - '' + - '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ' + - 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ' + - 'hostname=%NAME% ' + - 'fb=false debconf/frontend=noninteractive ' + - 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ' + - 'initrd=/install/initrd.gz -- ' +:kickstart_port: "7122" +:kickstart_timeout: "300" +:kickstart_file: "preseed.cfg" +:ssh_login_timeout: "10000" +: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: "shutdown -P now" +:postinstall_files: + - 'build_time.sh' + - 'apt.sh' + - 'vbox.sh' + - 'sudo.sh' + - 'ruby.sh' + - 'chef.sh' + - 'puppet.sh' + - 'vagrant.sh' + - 'cleanup.sh' +:postinstall_timeout: "10000" diff --git a/templates/ubuntu-12.04.5-server-i386/definition.rb b/templates/ubuntu-12.04.5-server-i386/definition.rb index 696267c7..fd3f4548 100644 --- a/templates/ubuntu-12.04.5-server-i386/definition.rb +++ b/templates/ubuntu-12.04.5-server-i386/definition.rb @@ -1,45 +1,5 @@ -Veewee::Session.declare({ - :cpu_count => '1', - :memory_size => '1024', - :disk_size => '65536', - :disk_format => 'VDI', - :hostiocache => 'off', - :os_type_id => 'Ubuntu', - :iso_file => "ubuntu-12.04.5-server-i386.iso", - :iso_src => "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-i386.iso", - :iso_md5 => "0081e57fb8c7e4094fb9767384f087c6", - :iso_download_timeout => "1000", - :boot_wait => "4", - :boot_cmd_sequence => [ - '', - '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ', - 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ', - 'hostname=%NAME% ', - 'fb=false debconf/frontend=noninteractive ', - 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ', - 'initrd=/install/initrd.gz -- ' -], - :kickstart_port => "7122", - :kickstart_timeout => "300", - :kickstart_file => "preseed.cfg", - :ssh_login_timeout => "10000", - :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 => "shutdown -P now", - :postinstall_files => [ - "build_time.sh", - "apt.sh", - "vbox.sh", - "sudo.sh", - "ruby.sh", - "chef.sh", - "puppet.sh", - "vagrant.sh", - "cleanup.sh" - ], - :postinstall_timeout => "10000" -}) +# +# Changed ubuntu-12.04.5-server-amd64 to *.yml configuration in this directory +# + +Veewee::Definition.declare_yaml('definition.yml') diff --git a/templates/ubuntu-12.04.5-server-i386/definition.yml b/templates/ubuntu-12.04.5-server-i386/definition.yml new file mode 100644 index 00000000..e735c5c5 --- /dev/null +++ b/templates/ubuntu-12.04.5-server-i386/definition.yml @@ -0,0 +1,41 @@ +:cpu_count: '1' +:memory_size: '1024' +:disk_size: '65536' +:disk_format: 'VDI' +:hostiocache: 'off' +:os_type_id: 'Ubuntu_64' +:iso_file: "ubuntu-12.04.5-server-i386.iso" +:iso_src: "http://releases.ubuntu.com/12.04/ubuntu-12.04.5-server-i386.iso" +:iso_md5: "1214cd22448338b60bb24f583dd8741a" +:iso_download_timeout: "1000" +:boot_wait: "4" +:boot_cmd_sequence: + - '' + - '/install/vmlinuz noapic preseed/url=http://%IP%:%PORT%/preseed.cfg ' + - 'debian-installer=en_US auto locale=en_US kbd-chooser/method=us ' + - 'hostname=%NAME% ' + - 'fb=false debconf/frontend=noninteractive ' + - 'keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=us keyboard-configuration/variant=us console-setup/ask_detect=false ' + - 'initrd=/install/initrd.gz -- ' +:kickstart_port: "7122" +:kickstart_timeout: "300" +:kickstart_file: "preseed.cfg" +:ssh_login_timeout: "10000" +: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: "shutdown -P now" +:postinstall_files: + - 'build_time.sh' + - 'apt.sh' + - 'vbox.sh' + - 'sudo.sh' + - 'ruby.sh' + - 'chef.sh' + - 'puppet.sh' + - 'vagrant.sh' + - 'cleanup.sh' +:postinstall_timeout: "10000"