Skip to content

Instantly share code, notes, and snippets.

@takumin
Created October 11, 2014 17:24
Show Gist options
  • Save takumin/e4cc496737b4b6d99f57 to your computer and use it in GitHub Desktop.
Save takumin/e4cc496737b4b6d99f57 to your computer and use it in GitHub Desktop.
{
"builders": [
{
"type": "virtualbox-iso",
"vm_name": "debian32-wheezy",
"boot_wait": "5s",
"hard_drive_interface": "sata",
"disk_size": 4096,
"guest_os_type": "Debian",
"iso_checksum": "528e1a7315da1bbf50bd4d187880a519",
"iso_checksum_type": "md5",
"iso_url": "http://cdimage.debian.or.jp/7.6.0/i386/iso-cd/debian-7.6.0-i386-netinst.iso",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo vagrant | sudo -S shutdown -hP now",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--bioslogodisplaytime", "500" ],
[ "modifyvm", "{{.Name}}", "--biosbootmenu", "disabled" ],
[ "modifyvm", "{{.Name}}", "--cpus", "1" ],
[ "modifyvm", "{{.Name}}", "--memory", "512" ],
[ "modifyvm", "{{.Name}}", "--audio", "none" ],
[ "modifyvm", "{{.Name}}", "--usb", "off" ],
[ "modifyvm", "{{.Name}}", "--usbehci", "off" ],
[ "modifyvm", "{{.Name}}", "--nictype1", "virtio" ],
[ "modifyvm", "{{.Name}}", "--natdnspassdomain1", "on" ],
[ "modifyvm", "{{.Name}}", "--natdnsproxy1", "off" ],
[ "modifyvm", "{{.Name}}", "--natdnshostresolver1", "off" ]
],
"http_directory": ".",
"boot_command": [
"<esc><wait>",
"install<wait>",
" auto=true<wait>",
" netcfg/get_hostname={{.Name}}<wait>",
" netcfg/get_domain=local<wait>",
" url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg<wait>",
"<enter><wait>"
]
}
],
"provisioners": [
{
"type": "shell",
"script": "postinstall.sh",
"override": {
"virtualbox-iso": {
"execute_command": "echo vagrant | {{.Vars}} sudo -E -S bash '{{.Path}}'"
}
}
}
],
"post-processors": [
{
"type": "vagrant",
"only": ["virtualbox-iso"],
"output": "debian32-wheezy.box"
}
]
}
{
"builders": [
{
"type": "virtualbox-iso",
"vm_name": "debian64-wheezy",
"boot_wait": "5s",
"hard_drive_interface": "sata",
"disk_size": 4096,
"guest_os_type": "Debian_64",
"iso_checksum": "8a3c2ad7fd7a9c4c7e9bcb5cae38c135",
"iso_checksum_type": "md5",
"iso_url": "http://cdimage.debian.or.jp/7.6.0/amd64/iso-cd/debian-7.6.0-amd64-netinst.iso",
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"shutdown_command": "echo vagrant | sudo -S shutdown -hP now",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--bioslogodisplaytime", "500" ],
[ "modifyvm", "{{.Name}}", "--biosbootmenu", "disabled" ],
[ "modifyvm", "{{.Name}}", "--cpus", "1" ],
[ "modifyvm", "{{.Name}}", "--memory", "512" ],
[ "modifyvm", "{{.Name}}", "--audio", "none" ],
[ "modifyvm", "{{.Name}}", "--usb", "off" ],
[ "modifyvm", "{{.Name}}", "--usbehci", "off" ],
[ "modifyvm", "{{.Name}}", "--nictype1", "virtio" ],
[ "modifyvm", "{{.Name}}", "--natdnspassdomain1", "on" ],
[ "modifyvm", "{{.Name}}", "--natdnsproxy1", "off" ],
[ "modifyvm", "{{.Name}}", "--natdnshostresolver1", "off" ]
],
"http_directory": ".",
"boot_command": [
"<esc><wait>",
"install<wait>",
" auto=true<wait>",
" netcfg/get_hostname={{.Name}}<wait>",
" netcfg/get_domain=local<wait>",
" url=http://{{.HTTPIP}}:{{.HTTPPort}}/preseed.cfg<wait>",
"<enter><wait>"
]
}
],
"provisioners": [
{
"type": "shell",
"script": "postinstall.sh",
"override": {
"virtualbox-iso": {
"execute_command": "echo vagrant | {{.Vars}} sudo -E -S bash '{{.Path}}'"
}
}
}
],
"post-processors": [
{
"type": "vagrant",
"only": ["virtualbox-iso"],
"output": "debian64-wheezy.box"
}
]
}
#!/bin/sh
# Update Package
apt-get -qy update
env DEBIAN_FRONTEND=noninteractive apt-get -qy upgrade
# Disable Exim
update-rc.d -f exim4 remove
# Boot Speed Up
echo '' >> /etc/default/grub
echo 'GRUB_HIDDEN_TIMEOUT=0' >> /etc/default/grub
echo 'GRUB_HIDDEN_TIMEOUT_QUIET=true' >> /etc/default/grub
update-grub
# Disable IPv6
echo 'net.ipv6.conf.all.disable_ipv6 = 1' > /etc/sysctl.d/disable_ipv6.conf
sysctl -p
# Set up password-less sudo for the vagrant user
echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/99_vagrant
chmod 440 /etc/sudoers.d/99_vagrant
# SSH Login Speed Up
echo '' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'GSSAPIAuthentication no' >> /etc/ssh/sshd_config
# Vagrant OpenSSH Public Key
mkdir /home/vagrant/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== Vagrant User' > /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
chmod -R go-rwsx /home/vagrant/.ssh
# Puppet Install
wget -O /tmp/puppetlabs-release-wheezy.deb http://apt.puppetlabs.com/puppetlabs-release-wheezy.deb
dpkg -i /tmp/puppetlabs-release-wheezy.deb
rm -f /tmp/puppetlabs-release-wheezy.deb
apt-get -qy update
apt-get -qy install puppet
# Virtualbox Guest Addtions
VER=$(cat /home/vagrant/.vbox_version)
mkdir /tmp/vbox
mount -o loop /home/vagrant/VBoxGuestAdditions.iso /tmp/vbox
echo 'yes' | sh /tmp/vbox/VBoxLinuxAdditions.run
ln -s /opt/VBoxGuestAdditions-${VER}/lib/VBoxGuestAdditions /usr/lib/
umount /tmp/vbox
rmdir /tmp/vbox
rm /home/vagrant/*.iso
# Cleanup
apt-get -qy autoremove
apt-get -qy clean
# Cleanup DHCP release
rm /var/lib/dhcp/*
# Minimize Virtualbox Image
dd if=/dev/zero of=/EMPTY bs=1M
rm -f /EMPTY
sync;sync;sync;
### Localization
d-i debian-installer/locale string ja_JP
d-i localechooser/supported-locales multiselect en_US.UTF-8, ja_JP.UTF-8
#d-i keymap select jp
d-i keyboard-configuration/xkb-keymap select jp
### Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/wireless_wep string
### Mirror settings
d-i mirror/protocol string http
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.jp.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/suite string wheezy
### Account setup
d-i passwd/root-login boolean false
d-i passwd/root-password password vagrant
d-i passwd/root-password-again password vagrant
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Vagrant User
d-i passwd/username string vagrant
d-i passwd/user-uid string 900
d-i passwd/user-password password vagrant
d-i passwd/user-password-again password vagrant
### Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string Japan
d-i clock-setup/ntp boolean false
### Partitioning
d-i partman-auto/method string lvm
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
# Install the GRUB boot loader to the master boot record?
d-i grub-installer/only_debian boolean true
### Package selection
tasksel tasksel/first multiselect minimal
d-i pkgsel/include string openssh-server sudo bzip2 acpid cryptsetup zlib1g-dev wget curl dkms make
d-i pkgsel/upgrade select none
popularity-contest popularity-contest/participate boolean false
### Finishing up the installation
d-i finish-install/reboot_in_progress note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment