├── .gitignore ├── LICENSE.md ├── digitalocean_reference ├── images.json ├── regions.json └── sizes.json ├── http_directory └── anaconda-ks.cfg ├── packer-digitalocean-centos-6_4-64.json ├── packer-virtualbox-centos-6_4-64.json ├── packer-vmware-centos-6_4-64.json └── provisioners ├── base-provision.sh ├── clean-empty-space.sh ├── install-virtualbox-guest-additions.sh └── install-vmware-guest-additions.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.box 2 | output-*/* 3 | packer_cache/* 4 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Geoffrey Wagner 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /digitalocean_reference/images.json: -------------------------------------------------------------------------------- 1 | {"status": "OK", "images": [ 2 | { 3 | "id": 1601, 4 | "name": "CentOS 5.8 x64", 5 | "slug": null, 6 | "distribution": "CentOS" 7 | }, 8 | { 9 | "id": 1602, 10 | "name": "CentOS 5.8 x32", 11 | "slug": null, 12 | "distribution": "CentOS" 13 | }, 14 | { 15 | "id": 12573, 16 | "name": "Debian 6.0 x64", 17 | "slug": null, 18 | "distribution": "Debian" 19 | }, 20 | { 21 | "id": 12575, 22 | "name": "Debian 6.0 x32", 23 | "slug": null, 24 | "distribution": "Debian" 25 | }, 26 | { 27 | "id": 14097, 28 | "name": "Ubuntu 10.04 x64", 29 | "slug": null, 30 | "distribution": "Ubuntu" 31 | }, 32 | { 33 | "id": 14098, 34 | "name": "Ubuntu 10.04 x32", 35 | "slug": null, 36 | "distribution": "Ubuntu" 37 | }, 38 | { 39 | "id": 32387, 40 | "name": "Fedora 17 x32", 41 | "slug": null, 42 | "distribution": "Fedora" 43 | }, 44 | { 45 | "id": 32399, 46 | "name": "Fedora 17 x32 Desktop", 47 | "slug": null, 48 | "distribution": "Fedora" 49 | }, 50 | { 51 | "id": 32419, 52 | "name": "Fedora 17 x64 Desktop", 53 | "slug": null, 54 | "distribution": "Fedora" 55 | }, 56 | { 57 | "id": 32428, 58 | "name": "Fedora 17 x64", 59 | "slug": null, 60 | "distribution": "Fedora" 61 | }, 62 | { 63 | "id": 284203, 64 | "name": "Ubuntu 12.04 x64", 65 | "slug": null, 66 | "distribution": "Ubuntu" 67 | }, 68 | { 69 | "id": 284211, 70 | "name": "Ubuntu 12.04 x32", 71 | "slug": null, 72 | "distribution": "Ubuntu" 73 | }, 74 | { 75 | "id": 303619, 76 | "name": "Debian 7.0 x32", 77 | "slug": null, 78 | "distribution": "Debian" 79 | }, 80 | { 81 | "id": 308287, 82 | "name": "Debian 7.0 x64", 83 | "slug": null, 84 | "distribution": "Debian" 85 | }, 86 | { 87 | "id": 345791, 88 | "name": "Ubuntu 13.04 x32", 89 | "slug": null, 90 | "distribution": "Ubuntu" 91 | }, 92 | { 93 | "id": 350076, 94 | "name": "Ubuntu 13.04 x64", 95 | "slug": null, 96 | "distribution": "Ubuntu" 97 | }, 98 | { 99 | "id": 350424, 100 | "name": "Arch Linux 2013.05 x64", 101 | "slug": null, 102 | "distribution": "Arch Linux" 103 | }, 104 | { 105 | "id": 361740, 106 | "name": "Arch Linux 2013.05 x32", 107 | "slug": null, 108 | "distribution": "Arch Linux" 109 | }, 110 | { 111 | "id": 365680, 112 | "name": "CentOS 6.4 x64", 113 | "slug": null, 114 | "distribution": "CentOS" 115 | }, 116 | { 117 | "id": 376568, 118 | "name": "CentOS 6.4 x32", 119 | "slug": null, 120 | "distribution": "CentOS" 121 | }, 122 | { 123 | "id": 433240, 124 | "name": "Ubuntu 12.10 x32", 125 | "slug": null, 126 | "distribution": "Ubuntu" 127 | }, 128 | { 129 | "id": 459444, 130 | "name": "LAMP on Ubuntu 12.04", 131 | "slug": null, 132 | "distribution": "Ubuntu" 133 | }, 134 | { 135 | "id": 464235, 136 | "name": "Ruby on Rails on Ubuntu 12.10 (Nginx + Unicorn)", 137 | "slug": null, 138 | "distribution": "Ubuntu" 139 | }, 140 | { 141 | "id": 473123, 142 | "name": "Ubuntu 12.10 x64", 143 | "slug": null, 144 | "distribution": "Ubuntu" 145 | }, 146 | { 147 | "id": 473136, 148 | "name": "Ubuntu 12.10 x64 Desktop", 149 | "slug": null, 150 | "distribution": "Ubuntu" 151 | }, 152 | { 153 | "id": 480257, 154 | "name": "Wordpress on Ubuntu 12.10", 155 | "slug": null, 156 | "distribution": "Ubuntu" 157 | }, 158 | { 159 | "id": 483575, 160 | "name": "Redmine on Ubuntu 12.04", 161 | "slug": null, 162 | "distribution": "Ubuntu" 163 | } 164 | ]} -------------------------------------------------------------------------------- /digitalocean_reference/regions.json: -------------------------------------------------------------------------------- 1 | {"status": "OK", "regions": [ 2 | { 3 | "id": 1, 4 | "name": "New York 1", 5 | "slug": "nyc1" 6 | }, 7 | { 8 | "id": 2, 9 | "name": "Amsterdam 1", 10 | "slug": "ams1" 11 | }, 12 | { 13 | "id": 3, 14 | "name": "San Francisco 1", 15 | "slug": "sfo1" 16 | } 17 | ]} -------------------------------------------------------------------------------- /digitalocean_reference/sizes.json: -------------------------------------------------------------------------------- 1 | {"status": "OK", "sizes": [ 2 | { 3 | "id": 66, 4 | "name": "512MB", 5 | "slug": null 6 | }, 7 | { 8 | "id": 63, 9 | "name": "1GB", 10 | "slug": null 11 | }, 12 | { 13 | "id": 62, 14 | "name": "2GB", 15 | "slug": null 16 | }, 17 | { 18 | "id": 64, 19 | "name": "4GB", 20 | "slug": null 21 | }, 22 | { 23 | "id": 65, 24 | "name": "8GB", 25 | "slug": null 26 | }, 27 | { 28 | "id": 61, 29 | "name": "16GB", 30 | "slug": null 31 | }, 32 | { 33 | "id": 60, 34 | "name": "32GB", 35 | "slug": null 36 | }, 37 | { 38 | "id": 70, 39 | "name": "48GB", 40 | "slug": null 41 | }, 42 | { 43 | "id": 69, 44 | "name": "64GB", 45 | "slug": null 46 | }, 47 | { 48 | "id": 68, 49 | "name": "96GB", 50 | "slug": null 51 | } 52 | ]} -------------------------------------------------------------------------------- /http_directory/anaconda-ks.cfg: -------------------------------------------------------------------------------- 1 | # Kickstart file automatically generated by anaconda. 2 | 3 | #version=DEVEL 4 | install 5 | cdrom 6 | text 7 | lang en_US.UTF-8 8 | keyboard us 9 | network --onboot yes --device eth0 --bootproto dhcp --noipv6 10 | rootpw --plaintext vagrant 11 | firewall --service=ssh 12 | authconfig --enableshadow --passalgo=sha512 13 | selinux --disabled 14 | timezone --utc America/Chicago 15 | bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" 16 | 17 | # The following is the partition information you requested 18 | # Note that any partitions you deleted are not expressed 19 | # here so unless you clear all partitions first, this is 20 | # not guaranteed to work 21 | 22 | # Clean out the old disk config 23 | zerombr 24 | 25 | # Clean out old partitions 26 | clearpart --all --drives=sda 27 | 28 | # Make a new partition for the volgroup 29 | part pv.008002 --size=39000 --ondisk=sda 30 | 31 | # Make the volgroup 32 | volgroup VolGroup --pesize=4096 pv.008002 33 | 34 | # Make / on the volgroup 35 | logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=37000 36 | 37 | # Setup swap on the volgroup 38 | logvol swap --name=lv_swap --vgname=VolGroup --grow --size=2016 --maxsize=2016 39 | 40 | # Setup the boot partition on the volgroup 41 | part /boot --fstype=ext4 --size=500 42 | 43 | # Location of the package data 44 | url --url http://mirrors.usinternet.com/centos/6.4/os/x86_64/ 45 | repo --name=epel --baseurl=http://download.fedoraproject.org/pub/epel/6/x86_64/ 46 | repo --name=updates --baseurl=http://mirrors.usinternet.com/centos/6.4/updates/x86_64/ 47 | 48 | %packages --nobase 49 | @core 50 | 51 | # For the virtualbox additions 52 | kernel-devel 53 | kernel-headers 54 | make 55 | dkms 56 | bzip2 57 | openssh-clients 58 | nano 59 | htop 60 | 61 | # required to build ruby 62 | # should be kept for gems that build native extensions. 63 | wget 64 | automake 65 | gcc 66 | cpp 67 | glibc-devel 68 | glibc-headers 69 | glibc-kernheaders 70 | glibc 71 | glibc-common 72 | libgcc 73 | 74 | # required to build ruby bindings, can be removed after 75 | zlib-devel 76 | openssl-devel 77 | readline-devel 78 | %end 79 | 80 | %post 81 | 82 | # Change to a vt to see progress 83 | 84 | exec < /dev/tty3 > /dev/tty3 85 | chvt 3 86 | 87 | # redirect output to ks-post.log including stdout and stderr 88 | ( 89 | ####################################################### 90 | # Build Ruby 91 | ####################################################### 92 | 93 | # Keep it clean 94 | mkdir /tmp/ruby 95 | cd /tmp/ruby 96 | 97 | # autoconf 2.60 is required to build ruby 98 | wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz 99 | tar -xzf autoconf-2.60.tar.gz 100 | cd autoconf-2.60 101 | ./configure --prefix=/usr && make && make install 102 | cd /tmp/ruby 103 | 104 | # build ruby-1.8.7-p358 105 | wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.bz2 106 | tar -xjf ruby-1.8.7-p358.tar.bz2 107 | cd ruby-1.8.7-p358 108 | autoconf 109 | ./configure --prefix=/usr && make && make install 110 | cd /tmp/ruby 111 | 112 | # install ruby-gems 1.8.10 113 | wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz 114 | tar -xzf rubygems-1.8.10.tgz 115 | cd rubygems-1.8.10 116 | /usr/bin/ruby setup.rb 117 | 118 | # clean up 119 | cd / 120 | rm -rf /tmp/ruby 121 | 122 | ####################################################### 123 | # Install Puppet 124 | ####################################################### 125 | gem install puppet --no-rdoc --no-ri 126 | 127 | # add the puppet group 128 | groupadd puppet 129 | 130 | ####################################################### 131 | # Turn off un-needed services 132 | ####################################################### 133 | chkconfig sendmail off 134 | chkconfig vbox-add-x11 off 135 | chkconfig smartd off 136 | chkconfig ntpd off 137 | chkconfig cupsd off 138 | 139 | ####################################################### 140 | # Setup for Vagrant 141 | ####################################################### 142 | groupadd admin 143 | useradd -g admin vagrant 144 | echo 'Defaults env_keep="SSH_AUTH_SOCK"' >> /etc/sudoers 145 | echo '%admin ALL=NOPASSWD: ALL' >> /etc/sudoers 146 | 147 | # Add vagrant insecure private key for key auth 148 | # Make your own if this is private. 149 | # See http://vagrantup.com/docs/base_boxes.html 150 | mkdir /home/vagrant/.ssh 151 | echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys 152 | 153 | ######################################################## 154 | # Cleanup for compression 155 | ####################################################### 156 | # Remove ruby build libs 157 | yum -y remove zlib-devel openssl-devel readline-devel 158 | 159 | # Cleanup other files we do not need 160 | yum -y groupremove "Dialup Networking Support" Editors "Printing Support" "Additional Development" "E-mail server" 161 | 162 | ####################################################### 163 | # The system can now be packaged with 164 | # `vagrant package VMNAME` 165 | ####################################################### 166 | echo 'You can now package this box with `vagrant package VMNAME`' 167 | 168 | ) 2>&1 | /usr/bin/tee /root/ks-post.log 169 | 170 | # switch back to gui 171 | chvt 7 172 | 173 | %end 174 | 175 | reboot -------------------------------------------------------------------------------- /packer-digitalocean-centos-6_4-64.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "api_key": "[YOUR API KEY]", 5 | "boot_wait": "5s", 6 | "client_id": "[YOUR CLIENT ID]", 7 | "image_id": 365680, 8 | "region_id": 1, 9 | "size_id": 66, 10 | "ssh_username": "root", 11 | "ssh_timeout": "20m", 12 | "type": "digitalocean", 13 | "snapshot_name": "packer-centos-6_4-64" 14 | } 15 | ], 16 | "provisioners": [ 17 | { 18 | "type": "shell", 19 | "script": "provisioners/base-provision.sh" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /packer-virtualbox-centos-6_4-64.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "boot_command": [ 5 | "", 6 | "linux ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg" 7 | ], 8 | "boot_wait": "5s", 9 | "disk_size": 40000, 10 | "guest_os_type": "RedHat_64", 11 | "headless": true, 12 | "http_directory": "./http_directory", 13 | "iso_checksum": "bb9af2aea1344597e11070abe6b1fcd3", 14 | "iso_checksum_type": "md5", 15 | "iso_url": "http://mirrors.usinternet.com/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-netinstall.iso", 16 | "ssh_password": "vagrant", 17 | "ssh_username": "root", 18 | "ssh_wait_timeout": "20m", 19 | "type": "virtualbox", 20 | "vboxmanage": [ 21 | ["modifyvm", "{{.Name}}", "--memory", "1024"], 22 | ["modifyvm", "{{.Name}}", "--cpus", "2"] 23 | ], 24 | "vm_name": "packer-centos-6_4-64" 25 | } 26 | ], 27 | "provisioners": [ 28 | { 29 | "type": "shell", 30 | "script": "provisioners/install-virtualbox-guest-additions.sh" 31 | }, 32 | { 33 | "type": "shell", 34 | "script": "provisioners/clean-empty-space.sh" 35 | } 36 | ], 37 | "post-processors": [ 38 | { 39 | "type": "vagrant", 40 | "output": "centos-6_4-64_virtualbox.box" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /packer-vmware-centos-6_4-64.json: -------------------------------------------------------------------------------- 1 | { 2 | "builders": [ 3 | { 4 | "boot_command": [ 5 | "", 6 | "linux ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/anaconda-ks.cfg" 7 | ], 8 | "boot_wait": "5s", 9 | "disk_size": 40000, 10 | "guest_os_type": "linux", 11 | "headless": true, 12 | "http_directory": "./http_directory", 13 | "iso_md5": "bb9af2aea1344597e11070abe6b1fcd3", 14 | "iso_url": "http://mirrors.usinternet.com/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-netinstall.iso", 15 | "skip_compaction": true, 16 | "ssh_password": "vagrant", 17 | "ssh_username": "root", 18 | "ssh_wait_timeout": "20m", 19 | "tools_upload_flavor": "linux", 20 | "type": "vmware", 21 | "vm_name": "packer-centos-6_4-64" 22 | } 23 | ], 24 | "provisioners": [ 25 | { 26 | "type": "shell", 27 | "script": "provisioners/install-vmware-guest-additions.sh" 28 | }, 29 | { 30 | "type": "shell", 31 | "script": "provisioners/clean-empty-space.sh" 32 | } 33 | ], 34 | "post-processors": [ 35 | { 36 | "type": "vagrant", 37 | "output": "centos-6_4-64_vmware.box" 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /provisioners/base-provision.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | yum install -y make bzip2 openssh-clients nano htop wget automake gcc cpp glibc-devel glibc-headers \ 4 | glibc-kernheaders glibc glibc-common libgcc zlib-devel openssl-devel readline-devel 5 | 6 | ####################################################### 7 | # Build Ruby 8 | ####################################################### 9 | 10 | # Keep it clean 11 | mkdir /tmp/ruby 12 | cd /tmp/ruby 13 | 14 | # autoconf 2.60 is required to build ruby 15 | wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz 16 | tar -xzf autoconf-2.60.tar.gz 17 | cd autoconf-2.60 18 | ./configure --prefix=/usr && make && make install 19 | cd /tmp/ruby 20 | 21 | # build ruby-1.8.7-p358 22 | wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.bz2 23 | tar -xjf ruby-1.8.7-p358.tar.bz2 24 | cd ruby-1.8.7-p358 25 | autoconf 26 | ./configure --prefix=/usr && make && make install 27 | cd /tmp/ruby 28 | 29 | # install ruby-gems 1.8.10 30 | wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz 31 | tar -xzf rubygems-1.8.10.tgz 32 | cd rubygems-1.8.10 33 | /usr/bin/ruby setup.rb 34 | 35 | # clean up 36 | cd / 37 | rm -rf /tmp/ruby 38 | 39 | ####################################################### 40 | # Install Puppet 41 | ####################################################### 42 | gem install puppet --no-rdoc --no-ri 43 | 44 | # add the puppet group 45 | groupadd puppet 46 | 47 | ####################################################### 48 | # Turn off un-needed services 49 | ####################################################### 50 | chkconfig sendmail off 51 | chkconfig vbox-add-x11 off 52 | chkconfig smartd off 53 | chkconfig ntpd off 54 | chkconfig cupsd off 55 | 56 | ######################################################## 57 | # Cleanup for compression 58 | ####################################################### 59 | # Remove ruby build libs 60 | yum -y remove zlib-devel openssl-devel readline-devel 61 | 62 | # Cleanup other files we do not need 63 | yum -y groupremove "Dialup Networking Support" Editors "Printing Support" "Additional Development" "E-mail server" 64 | 65 | # Clean cache 66 | yum clean all 67 | 68 | # Clean out all of the caching dirs 69 | rm -rf /var/cache/* /usr/share/doc/* -------------------------------------------------------------------------------- /provisioners/clean-empty-space.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Saves ~25M 4 | yum -y remove kernel-devel 5 | 6 | # Clean cache 7 | yum clean all 8 | 9 | # Clean out all of the caching dirs 10 | rm -rf /var/cache/* /usr/share/doc/* 11 | 12 | # Clean up unused disk space so compressed image is smaller. 13 | cat /dev/zero > /tmp/zero.fill 14 | rm /tmp/zero.fill -------------------------------------------------------------------------------- /provisioners/install-virtualbox-guest-additions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Mount the disk image 4 | cd /tmp 5 | mkdir /tmp/isomount 6 | mount -t iso9660 -o loop /root/VBoxGuestAdditions.iso /tmp/isomount 7 | 8 | # Install the drivers 9 | /tmp/isomount/VBoxLinuxAdditions.run 10 | 11 | # Cleanup 12 | umount isomount 13 | rm -rf isomount /root/VBoxGuestAdditions.iso -------------------------------------------------------------------------------- /provisioners/install-vmware-guest-additions.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure perl is available 4 | yum -y install perl 5 | 6 | # Mount the disk image 7 | cd /tmp 8 | mkdir /tmp/isomount 9 | mount -t iso9660 -o loop /root/linux.iso /tmp/isomount 10 | 11 | # Install the drivers 12 | cp /tmp/isomount/VMwareTools-*.gz /tmp 13 | tar -zxvf VMwareTools*.gz 14 | ./vmware-tools-distrib/vmware-install.pl -d 15 | 16 | # Cleanup 17 | umount isomount 18 | rm -rf isomount /root/linux.iso VMwareTools*.gz vmware-tools-distrib --------------------------------------------------------------------------------