-
-
Save floodedcodeboy/5916431 to your computer and use it in GitHub Desktop.
packer.io config files to go from pristine vanilla ubuntu 12.04 LTS to a docker.io and chef-enabled vagrant box The resulting image is still a bit large and doesn't yet follow all the vagrant conventions, but it's a start.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## install software for the base box to come packaged with - these will always be updated with chef/pupput | |
apt-get -y update && apt-get -y upgrade | |
apt-get install -y linux-image-generic-lts-raring linux-headers-generic-lts-raring build-essential dkms rubygems lxc-docker zlib1g-dev libssl-dev libreadline6-dev libyaml-dev ruby1.8 curl wget git-core gcc g++ make autoconf python-software-properties screen puppet puppetmaster openssl-server | |
sudo /usr/bin/gem install chef ruby-shadow --no-ri --no-rdoc | |
## create the vagrant user | |
sudo useradd -d /home/vagrant -m vagrant -p vagrant | |
## setup the vagrant user groupex | |
mkdir -m 0711 /home/ubuntu/.ssh/ | |
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key' > /home/ubuntu/.ssh/authorized_keys | |
sudo groupadd admin | |
sudo usermod -G admin vagrant | |
echo '%admin ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers | |
echo 'UseDNS no' >> /etc/ssh/sshd_config | |
## install the vagrant public & private keys | |
mkdir /home/vagrant/.ssh/ | |
cd /home/vagrant/.ssh | |
wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant | |
wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub | |
mv vagrant.pub /home/vagrant/.ssh/authorized_keys | |
## install the vbox guest additions | |
mkdir /mnt/VBoxGuestAdditions | |
mount /home/ubuntu/VBoxGuestAdditions.iso /mnt/VBoxGuestAdditions | |
sh /mnt/VBoxGuestAdditions/VBoxLinuxAdditions.run | |
## clean up the install | |
apt-get dist-upgrade -y | |
apt-get clean | |
## cleanup the vbox guest additions | |
umount /mnt/VBoxGuestAdditions | |
rmdir /mnt/VBoxGuestAdditions | |
rm /home/ubuntu/VBoxGuestAdditions.iso |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d-i debian-installer/locale string en_US.UTF-8 | |
d-i console-setup/ask_detect boolean false | |
d-i keyboard-configuration/modelcode string pc105 | |
d-i netcfg/choose_interface select auto | |
d-i netcfg/get_hostname string vagrant-precise64 | |
d-i netcfg/get_domain string vagrant.com | |
d-i netcfg/wireless_wep string | |
d-i mirror/country string Great Britain | |
d-i mirror/http/mirror select gb.archive.ubuntu.com | |
d-i mirror/http/hostname string gb.archive.ubuntu.com | |
d-i mirror/http/directory string /ubuntu | |
d-i mirror/http/proxy string | |
d-i mirror/suite string precise | |
d-i clock-setup/utc boolean true | |
d-i time/zone string Europe/London | |
d-i clock-setup/ntp boolean true | |
d-i partman-auto/init_automatically_partition select biggest_free | |
d-i partman-auto/disk string /dev/sda | |
d-i partman-auto/method string regular | |
#d-i partman-auto/choose_recipe select atomic | |
d-i partman/default_filesystem string ext4 | |
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 | |
d-i partman/mount_style select label | |
#d-i base-installer/kernel/image string linux-generic | |
#d-i base-installer/kernel/image string linux-generic-lts-raring | |
d-i passwd/user-fullname string Ubuntu User | |
d-i passwd/username string ubuntu | |
d-i passwd/user-password password ubuntu | |
d-i passwd/user-password-again password ubuntu | |
d-i user-setup/allow-password-weak boolean true | |
d-i user-setup/encrypt-home boolean false | |
# Add docker repository: | |
d-i apt-setup/local0/repository string \ | |
http://ppa.launchpad.net/dotcloud/lxc-docker/ubuntu precise main | |
d-i apt-setup/local0/comment string dotcloud-lxc-docker | |
d-i apt-setup/local0/source boolean true | |
d-i apt-setup/local0/key string \ | |
http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE61D797F63561DC6 | |
tasksel tasksel/first multiselect standard | |
d-i pkgsel/include string openssh-server build-essential | |
d-i pkgsel/upgrade select full-upgrade | |
d-i pkgsel/install-language-support boolean false | |
# d-i pkgsel/language-packs multiselect en | |
# d-i pkgsel/update-policy select none | |
d-i pkgsel/update-policy select unattended-upgrades | |
d-i pkgsel/updatedb boolean true | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"type": "virtualbox", | |
"guest_os_type": "Ubuntu_64", | |
"iso_url": "http://releases.ubuntu.com/precise/ubuntu-12.04.2-server-amd64.iso", | |
"iso_md5": "af5f788aee1b32c4b2634734309cc9e9", | |
"ssh_username": "ubuntu", | |
"ssh_password": "ubuntu", | |
"ssh_wait_timeout": "2000s", | |
"disk_size": 40000, | |
"guest_additions_path": "", | |
"http_directory": "configs/", | |
"http_port_min": 8000, | |
"http_port_max": 9000, | |
"output_directory": "./boxout/", | |
"boot_command": [ | |
"<esc><esc><enter><wait>", | |
"/install/vmlinuz noapic ", | |
"preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ", | |
"debian-installer=en_US auto locale=en_US kbd-chooser/method=gb ", | |
"hostname=vagrant-precise64 ", | |
"fb=false debconf/frontend=noninteractive ", | |
"keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=GB ", | |
"keyboard-configuration/variant=GB console-setup/ask_detect=false ", | |
"initrd=/install/initrd.gz -- <enter>" | |
] | |
} | |
], | |
"provisioners": [{ | |
"type": "shell", | |
"script": "./configs/packer-bootstrap.sh", | |
"execute_command" : "echo 'ubuntu' | sudo -S sh '{{ .Path }}'" | |
}], | |
"post-processors": [{ | |
"type": "vagrant", | |
"vagrantfile_template": "configs/Vagrantfile_template" | |
}] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment