Skip to content
This repository

Added new template Debian-7.0-b3-amd64-netboot #418

Merged
merged 1 commit into from over 1 year ago

2 participants

Thomas Berton Patrick Debois
Thomas Berton

Added a new template: Debian-7.0-b3-amd64-netboot

Patrick Debois jedi4ever merged commit 4b2728b into from
Patrick Debois
Owner

thx @tberton !

Pete Cheslock petecheslock referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 31, 2012
Thomas Berton tberton added new Template Debian-7.0-b3-amd64-netboot aec02ba
This page is out of date. Refresh to see the latest.
27 templates/Debian-7.0-b3-amd64-netboot/base.sh
... ... @@ -0,0 +1,27 @@
  1 +# Update the box
  2 +apt-get -y update
  3 +apt-get -y install linux-headers-$(uname -r) build-essential
  4 +apt-get -y install zlib1g-dev libssl-dev libreadline5-dev
  5 +apt-get -y install curl unzip
  6 +apt-get clean
  7 +
  8 +# Set up sudo
  9 +cp /etc/sudoers /etc/sudoers.orig
  10 +sed -i -e 's/%sudo[ \t]*ALL=(ALL:ALL) ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
  11 +
  12 +# Tweak sshd to prevent DNS resolution (speed up logins)
  13 +echo 'UseDNS no' >> /etc/ssh/sshd_config
  14 +
  15 +# Remove 5s grub timeout to speed up booting
  16 +echo <<EOF > /etc/default/grub
  17 +# If you change this file, run 'update-grub' afterwards to update
  18 +# /boot/grub/grub.cfg.
  19 +
  20 +GRUB_DEFAULT=0
  21 +GRUB_TIMEOUT=0
  22 +GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
  23 +GRUB_CMDLINE_LINUX_DEFAULT="quiet"
  24 +GRUB_CMDLINE_LINUX="debian-installer=en_US"
  25 +EOF
  26 +
  27 +update-grub
2  templates/Debian-7.0-b3-amd64-netboot/chef.sh
... ... @@ -0,0 +1,2 @@
  1 +# Install Chef
  2 +gem install chef --no-ri --no-rdoc
4 templates/Debian-7.0-b3-amd64-netboot/cleanup-virtualbox.sh
... ... @@ -0,0 +1,4 @@
  1 +# Cleanup Virtualbox
  2 +VBOX_VERSION=$(cat .vbox_version)
  3 +VBOX_ISO=VBoxGuestAdditions_$VBOX_VERSION.iso
  4 +rm $VBOX_ISO
17 templates/Debian-7.0-b3-amd64-netboot/cleanup.sh
... ... @@ -0,0 +1,17 @@
  1 +# Clean up
  2 +apt-get -y remove linux-headers-$(uname -r) build-essential
  3 +apt-get -y autoremove
  4 +
  5 +# Removing leftover leases and persistent rules
  6 +echo "cleaning up dhcp leases"
  7 +rm /var/lib/dhcp/*
  8 +
  9 +# Make sure Udev doesn't block our network
  10 +echo "cleaning up udev rules"
  11 +rm /etc/udev/rules.d/70-persistent-net.rules
  12 +mkdir /etc/udev/rules.d/70-persistent-net.rules
  13 +rm -rf /dev/.udev/
  14 +rm /lib/udev/rules.d/75-persistent-net-generator.rules
  15 +
  16 +echo "Adding a 2 sec delay to the interface up, to make the dhclient happy"
  17 +echo "pre-up sleep 2" >> /etc/network/interfaces
51 templates/Debian-7.0-b3-amd64-netboot/definition.rb
... ... @@ -0,0 +1,51 @@
  1 +#Thanks to Fletcher Nichol - https://github.com/fnichol
  2 +
  3 +Veewee::Definition.declare({
  4 + :cpu_count => '1',
  5 + :memory_size=> '256',
  6 + :disk_size => '10140', :disk_format => 'VDI', :hostiocache => 'off',
  7 + :os_type_id => 'Debian',
  8 + :iso_file => "debian-wheezy-DI-b3-amd64-netinst.iso",
  9 + :iso_src => "http://cdimage.debian.org/cdimage/wheezy_di_beta3/amd64/iso-cd/debian-wheezy-DI-b3-amd64-netinst.iso",
  10 + :iso_md5 => "e9f2479c43a623dd8b9c0bc95d8460ce",
  11 + :iso_download_timeout => "1000",
  12 + :boot_wait => "10", :boot_cmd_sequence => [
  13 + '<Esc>',
  14 + 'install ',
  15 + 'preseed/url=http://%IP%:%PORT%/preseed.cfg ',
  16 + 'debian-installer=en_US ',
  17 + 'auto ',
  18 + 'locale=en_US ',
  19 + 'kbd-chooser/method=us ',
  20 + 'netcfg/get_hostname=%NAME% ',
  21 + 'netcfg/get_domain=vagrantup.com ',
  22 + 'fb=false ',
  23 + 'debconf/frontend=noninteractive ',
  24 + 'console-setup/ask_detect=false ',
  25 + 'keyboard-configuration/xkb-keymap=us ',
  26 + '<Enter>'
  27 + ],
  28 + :kickstart_port => "7122",
  29 + :kickstart_timeout => "10000",
  30 + :kickstart_file => "preseed.cfg",
  31 + :ssh_login_timeout => "10000",
  32 + :ssh_user => "vagrant",
  33 + :ssh_password => "vagrant",
  34 + :ssh_key => "",
  35 + :ssh_host_port => "7222",
  36 + :ssh_guest_port => "22",
  37 + :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
  38 + :shutdown_cmd => "halt -p",
  39 + :postinstall_files => [
  40 + "base.sh",
  41 + "vagrant.sh",
  42 + "virtualbox.sh",
  43 + "ruby.sh",
  44 + "puppet.sh",
  45 + "chef.sh",
  46 + "cleanup-virtualbox.sh",
  47 + "cleanup.sh",
  48 + "zerodisk.sh"
  49 + ],
  50 + :postinstall_timeout => "10000"
  51 +})
313 templates/Debian-7.0-b3-amd64-netboot/preseed.cfg
... ... @@ -0,0 +1,313 @@
  1 +#### Contents of the preconfiguration file (for squeeze)
  2 +### Localization
  3 +# Locale sets language and country.
  4 +d-i debian-installer/locale string en_US
  5 +
  6 +# Keyboard selection.
  7 +#d-i keymap select us
  8 +d-i keyboard-configuration/xkb-keymap select us
  9 +
  10 +### Network configuration
  11 +# netcfg will choose an interface that has link if possible. This makes it
  12 +# skip displaying a list if there is more than one interface.
  13 +d-i netcfg/choose_interface select auto
  14 +
  15 +# To pick a particular interface instead:
  16 +#d-i netcfg/choose_interface select eth1
  17 +
  18 +# If you have a slow dhcp server and the installer times out waiting for
  19 +# it, this might be useful.
  20 +#d-i netcfg/dhcp_timeout string 60
  21 +
  22 +# If you prefer to configure the network manually, uncomment this line and
  23 +# the static network configuration below.
  24 +#d-i netcfg/disable_dhcp boolean true
  25 +
  26 +# If you want the preconfiguration file to work on systems both with and
  27 +# without a dhcp server, uncomment these lines and the static network
  28 +# configuration below.
  29 +#d-i netcfg/dhcp_failed note
  30 +#d-i netcfg/dhcp_options select Configure network manually
  31 +
  32 +# Static network configuration.
  33 +#d-i netcfg/get_nameservers string 192.168.1.1
  34 +#d-i netcfg/get_ipaddress string 192.168.1.42
  35 +#d-i netcfg/get_netmask string 255.255.255.0
  36 +#d-i netcfg/get_gateway string 192.168.1.1
  37 +#d-i netcfg/confirm_static boolean true
  38 +
  39 +# Any hostname and domain names assigned from dhcp take precedence over
  40 +# values set here. However, setting the values still prevents the questions
  41 +# from being shown, even if values come from dhcp.
  42 +#d-i netcfg/get_hostname string vagrant
  43 +d-i netcfg/get_domain string vagrantup.com
  44 +
  45 +# Disable that annoying WEP key dialog.
  46 +d-i netcfg/wireless_wep string
  47 +# The wacky dhcp hostname that some ISPs use as a password of sorts.
  48 +#d-i netcfg/dhcp_hostname string radish
  49 +
  50 +# If non-free firmware is needed for the network or other hardware, you can
  51 +# configure the installer to always try to load it, without prompting. Or
  52 +# change to false to disable asking.
  53 +#d-i hw-detect/load_firmware boolean true
  54 +
  55 +### Network console
  56 +# Use the following settings if you wish to make use of the network-console
  57 +# component for remote installation over SSH. This only makes sense if you
  58 +# intend to perform the remainder of the installation manually.
  59 +#d-i anna/choose_modules string network-console
  60 +#d-i network-console/password password r00tme
  61 +#d-i network-console/password-again password r00tme
  62 +
  63 +### Mirror settings
  64 +# If you select ftp, the mirror/country string does not need to be set.
  65 +#d-i mirror/protocol string ftp
  66 +d-i mirror/country string manual
  67 +d-i mirror/http/hostname string http.us.debian.org
  68 +d-i mirror/http/directory string /debian
  69 +d-i mirror/http/proxy string
  70 +
  71 +# Suite to install.
  72 +#d-i mirror/suite string testing
  73 +# Suite to use for loading installer components (optional).
  74 +#d-i mirror/udeb/suite string testing
  75 +
  76 +### Clock and time zone setup
  77 +# Controls whether or not the hardware clock is set to UTC.
  78 +d-i clock-setup/utc boolean true
  79 +
  80 +# You may set this to any valid setting for $TZ; see the contents of
  81 +# /usr/share/zoneinfo/ for valid values.
  82 +d-i time/zone string UTC
  83 +
  84 +# Controls whether to use NTP to set the clock during the install
  85 +d-i clock-setup/ntp boolean true
  86 +# NTP server to use. The default is almost always fine here.
  87 +#d-i clock-setup/ntp-server string ntp.example.com
  88 +
  89 +### Partitioning
  90 +# If the system has free space you can choose to only partition that space.
  91 +#d-i partman-auto/init_automatically_partition select biggest_free
  92 +
  93 +# Alternatively, you can specify a disk to partition. The device name must
  94 +# be given in traditional non-devfs format.
  95 +# Note: A disk must be specified, unless the system has only one disk.
  96 +# For example, to use the first SCSI/SATA hard disk:
  97 +d-i partman-auto/disk string /dev/sda
  98 +# In addition, you'll need to specify the method to use.
  99 +# The presently available methods are: "regular", "lvm" and "crypto"
  100 +d-i partman-auto/method string lvm
  101 +
  102 +# If one of the disks that are going to be automatically partitioned
  103 +# contains an old LVM configuration, the user will normally receive a
  104 +# warning. This can be preseeded away...
  105 +d-i partman-lvm/device_remove_lvm boolean true
  106 +# The same applies to pre-existing software RAID array:
  107 +d-i partman-md/device_remove_md boolean true
  108 +
  109 +# And the same goes for the confirmation to write the lvm partitions.
  110 +d-i partman-lvm/confirm boolean true
  111 +d-i partman-lvm/confirm_nooverwrite boolean true
  112 +
  113 +
  114 +d-i partman/choose_partition select finish
  115 +d-i partman-auto-lvm/guided_size string max
  116 +
  117 +# You can choose one of the three predefined partitioning recipes:
  118 +# - atomic: all files in one partition
  119 +# - home: separate /home partition
  120 +# - multi: separate /home, /usr, /var, and /tmp partitions
  121 +d-i partman-auto/choose_recipe select atomic
  122 +d-i partman/default_filesystem string ext3
  123 +
  124 +# Or provide a recipe of your own...
  125 +# The recipe format is documented in the file devel/partman-auto-recipe.txt.
  126 +# If you have a way to get a recipe file into the d-i environment, you can
  127 +# just point at it.
  128 +#d-i partman-auto/expert_recipe_file string /hd-media/recipe
  129 +
  130 +# If not, you can put an entire recipe into the preconfiguration file in one
  131 +# (logical) line. This example creates a small /boot partition, suitable
  132 +# swap, and uses the rest of the space for the root partition:
  133 +#d-i partman-auto/expert_recipe string \
  134 +# boot-root :: \
  135 +# 40 50 100 ext3 \
  136 +# $primary{ } $bootable{ } \
  137 +# method{ format } format{ } \
  138 +# use_filesystem{ } filesystem{ ext3 } \
  139 +# mountpoint{ /boot } \
  140 +# . \
  141 +# 500 10000 1000000000 ext3 \
  142 +# method{ format } format{ } \
  143 +# use_filesystem{ } filesystem{ ext3 } \
  144 +# mountpoint{ / } \
  145 +# . \
  146 +# 64 512 300% linux-swap \
  147 +# method{ swap } format{ } \
  148 +# .
  149 +
  150 +#The preseed line that "selects finish" needs to be in a certain order in your preseed, the example-preseed does not follow this.
  151 +#http://ubuntuforums.org/archive/index.php/t-1504045.html
  152 +
  153 +# This makes partman automatically partition without confirmation, provided
  154 +# that you told it what to do using one of the methods above.
  155 +d-i partman/confirm_write_new_label boolean true
  156 +d-i partman/confirm boolean true
  157 +d-i partman/confirm_nooverwrite boolean true
  158 +
  159 +
  160 +### Base system installation
  161 +# Select the initramfs generator used to generate the initrd for 2.6 kernels.
  162 +#d-i base-installer/kernel/linux/initramfs-generators string yaird
  163 +
  164 +# The kernel image (meta) package to be installed; "none" can be used if no
  165 +# kernel is to be installed.
  166 +#d-i base-installer/kernel/image string linux-image-2.6-486
  167 +
  168 +### Account setup
  169 +# Skip creation of a root account (normal user account will be able to
  170 +# use sudo).
  171 +d-i passwd/root-login boolean false
  172 +# Alternatively, to skip creation of a normal user account.
  173 +#d-i passwd/make-user boolean false
  174 +
  175 +# Root password, either in clear text
  176 +d-i passwd/root-password password vagrant
  177 +d-i passwd/root-password-again password vagrant
  178 +# or encrypted using an MD5 hash.
  179 +#d-i passwd/root-password-crypted password [MD5 hash]
  180 +
  181 +# To create a normal user account.
  182 +d-i passwd/user-fullname string Vagrant User
  183 +d-i passwd/username string vagrant
  184 +# Normal user's password, either in clear text
  185 +d-i passwd/user-password password vagrant
  186 +d-i passwd/user-password-again password vagrant
  187 +# or encrypted using an MD5 hash.
  188 +#d-i passwd/user-password-crypted password [MD5 hash]
  189 +# Create the first user with the specified UID instead of the default.
  190 +#d-i passwd/user-uid string 1010
  191 +d-i user-setup/encrypt-home boolean false
  192 +d-i user-setup/allow-password-weak boolean true
  193 +
  194 +# The user account will be added to some standard initial groups. To
  195 +# override that, use this.
  196 +d-i passwd/user-default-groups string audio cdrom video admin
  197 +
  198 +### Apt setup
  199 +# You can choose to install non-free and contrib software.
  200 +#d-i apt-setup/non-free boolean true
  201 +#d-i apt-setup/contrib boolean true
  202 +# Uncomment this if you don't want to use a network mirror.
  203 +#d-i apt-setup/use_mirror boolean false
  204 +# Select which update services to use; define the mirrors to be used.
  205 +# Values shown below are the normal defaults.
  206 +#d-i apt-setup/services-select multiselect security, volatile
  207 +#d-i apt-setup/security_host string security.debian.org
  208 +#d-i apt-setup/volatile_host string volatile.debian.org
  209 +
  210 +
  211 +# By default the installer requires that repositories be authenticated
  212 +# using a known gpg key. This setting can be used to disable that
  213 +# authentication. Warning: Insecure, not recommended.
  214 +#d-i debian-installer/allow_unauthenticated string true
  215 +
  216 +### Package selection
  217 +tasksel tasksel/first multiselect standard
  218 +# If the desktop task is selected, install the kde and xfce desktops
  219 +# instead of the default gnome desktop.
  220 +#tasksel tasksel/desktop multiselect kde, xfce
  221 +
  222 +# Individual additional packages to install
  223 +d-i pkgsel/include string openssh-server ntp acpid sudo bzip2
  224 +
  225 +# Whether to upgrade packages after debootstrap.
  226 +# Allowed values: none, safe-upgrade, full-upgrade
  227 +d-i pkgsel/upgrade select none
  228 +
  229 +# Some versions of the installer can report back on what software you have
  230 +# installed, and what software you use. The default is not to report back,
  231 +# but sending reports helps the project determine what software is most
  232 +# popular and include it on CDs.
  233 +popularity-contest popularity-contest/participate boolean false
  234 +
  235 +### Boot loader installation
  236 +# Grub is the default boot loader (for x86). If you want lilo installed
  237 +# instead, uncomment this:
  238 +#d-i grub-installer/skip boolean true
  239 +# To also skip installing lilo, and install no bootloader, uncomment this
  240 +# too:
  241 +#d-i lilo-installer/skip boolean true
  242 +
  243 +# This is fairly safe to set, it makes grub install automatically to the MBR
  244 +# if no other operating system is detected on the machine.
  245 +d-i grub-installer/only_debian boolean true
  246 +
  247 +# This one makes grub-installer install to the MBR if it also finds some other
  248 +# OS, which is less safe as it might not be able to boot that other OS.
  249 +d-i grub-installer/with_other_os boolean true
  250 +
  251 +# Alternatively, if you want to install to a location other than the mbr,
  252 +# uncomment and edit these lines:
  253 +#d-i grub-installer/only_debian boolean false
  254 +#d-i grub-installer/with_other_os boolean false
  255 +#d-i grub-installer/bootdev string (hd0,0)
  256 +# To install grub to multiple disks:
  257 +#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0)
  258 +
  259 +# Optional password for grub, either in clear text
  260 +#d-i grub-installer/password password r00tme
  261 +#d-i grub-installer/password-again password r00tme
  262 +# or encrypted using an MD5 hash, see grub-md5-crypt(8).
  263 +#d-i grub-installer/password-crypted password [MD5 hash]
  264 +
  265 +### Finishing up the installation
  266 +# During installations from serial console, the regular virtual consoles
  267 +# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
  268 +# line to prevent this.
  269 +#d-i finish-install/keep-consoles boolean true
  270 +
  271 +# Avoid that last message about the install being complete.
  272 +d-i finish-install/reboot_in_progress note
  273 +
  274 +# This will prevent the installer from ejecting the CD during the reboot,
  275 +# which is useful in some situations.
  276 +#d-i cdrom-detect/eject boolean false
  277 +
  278 +# This is how to make the installer shutdown when finished, but not
  279 +# reboot into the installed system.
  280 +#d-i debian-installer/exit/halt boolean true
  281 +# This will power off the machine instead of just halting it.
  282 +#d-i debian-installer/exit/poweroff boolean true
  283 +
  284 +### Preseeding other packages
  285 +# Depending on what software you choose to install, or if things go wrong
  286 +# during the installation process, it's possible that other questions may
  287 +# be asked. You can preseed those too, of course. To get a list of every
  288 +# possible question that could be asked during an install, do an
  289 +# installation, and then run these commands:
  290 +# debconf-get-selections --installer > file
  291 +# debconf-get-selections >> file
  292 +
  293 +
  294 +#### Advanced options
  295 +### Running custom commands during the installation
  296 +# d-i preseeding is inherently not secure. Nothing in the installer checks
  297 +# for attempts at buffer overflows or other exploits of the values of a
  298 +# preconfiguration file like this one. Only use preconfiguration files from
  299 +# trusted locations! To drive that home, and because it's generally useful,
  300 +# here's a way to run any shell command you'd like inside the installer,
  301 +# automatically.
  302 +
  303 +# This first command is run as early as possible, just after
  304 +# preseeding is read.
  305 +# Prevent packaged version of VirtualBox Guest Additions being installed:
  306 +d-i preseed/early_command string sed -i \
  307 + '/in-target/idiscover(){/sbin/discover|grep -v VirtualBox;}' \
  308 + /usr/lib/pre-pkgsel.d/20install-hwpackages
  309 +
  310 +# This command is run just before the install finishes, but when there is
  311 +# still a usable /target directory. You can chroot to /target and use it
  312 +# directly, or use the apt-install and in-target commands to easily install
  313 +# packages and run commands in the target system.
2  templates/Debian-7.0-b3-amd64-netboot/puppet.sh
... ... @@ -0,0 +1,2 @@
  1 +# Install Puppet
  2 +gem install puppet --no-ri --no-rdoc
10 templates/Debian-7.0-b3-amd64-netboot/ruby.sh
... ... @@ -0,0 +1,10 @@
  1 +# Install Ruby from packages
  2 +apt-get -y install ruby ruby-dev libopenssl-ruby1.8 irb ri rdoc
  3 +
  4 +# Install Rubygems from source
  5 +rg_ver=1.8.22
  6 +curl -o /tmp/rubygems-${rg_ver}.zip \
  7 + "http://production.cf.rubygems.org/rubygems/rubygems-${rg_ver}.zip"
  8 +(cd /tmp && unzip rubygems-${rg_ver}.zip && \
  9 + cd rubygems-${rg_ver} && ruby setup.rb --no-format-executable)
  10 +rm -rf /tmp/rubygems-${rg_ver} /tmp/rubygems-${rg_ver}.zip
25 templates/Debian-7.0-b3-amd64-netboot/vagrant.sh
... ... @@ -0,0 +1,25 @@
  1 +# Set up Vagrant.
  2 +
  3 +date > /etc/vagrant_box_build_time
  4 +
  5 +# Add groups puppet and chef
  6 +groupadd puppet
  7 +groupadd chef
  8 +
  9 +# Create the user vagrant with password vagrant
  10 +useradd -G sudo -p $(perl -e'print crypt("vagrant", "vagrant")') -m -s /bin/bash -N vagrant
  11 +
  12 +# Install vagrant keys
  13 +mkdir -pm 700 /home/vagrant/.ssh
  14 +curl -Lo /home/vagrant/.ssh/authorized_keys \
  15 + 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
  16 +chmod 0600 /home/vagrant/.ssh/authorized_keys
  17 +chown -R vagrant:vagrant /home/vagrant/.ssh
  18 +
  19 +# Customize the message of the day
  20 +echo 'Welcome to your Vagrant-built virtual machine.' > /var/run/motd
  21 +
  22 +# Install NFS client
  23 +apt-get -y install nfs-common
  24 +
  25 +
13 templates/Debian-7.0-b3-amd64-netboot/virtualbox.sh
... ... @@ -0,0 +1,13 @@
  1 +if test -f .vbox_version ; then
  2 + # The netboot installs the VirtualBox support (old) so we have to remove it
  3 + /etc/init.d/virtualbox-ose-guest-utils stop
  4 + rmmod vboxguest
  5 + aptitude -y purge virtualbox-ose-guest-x11 virtualbox-ose-guest-dkms virtualbox-ose-guest-utils
  6 +
  7 + # Install the VirtualBox guest additions
  8 + VBOX_VERSION=$(cat .vbox_version)
  9 + VBOX_ISO=VBoxGuestAdditions_$VBOX_VERSION.iso
  10 + mount -o loop $VBOX_ISO /mnt
  11 + yes|sh /mnt/VBoxLinuxAdditions.run
  12 + umount /mnt
  13 +fi
3  templates/Debian-7.0-b3-amd64-netboot/zerodisk.sh
... ... @@ -0,0 +1,3 @@
  1 +# Zero out the free space to save space in the final image:
  2 +dd if=/dev/zero of=/EMPTY bs=1M
  3 +rm -f /EMPTY

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.