A template for provisioning any new Vagrant
project that will will install a core set of useful packages as well as
personal dotfiles. It uses Chef Solo
and includes support for using knife
commands with the local cookbooks/ directory.
The installed packages include:
- ack
- ctags
- curl
- dkms
- git
- htop
- lsof
- mercurial
- tmux
- tree
- rbenv (with ruby-build)
- vim
- zsh
Many of these come directly from the Opscode Community Cookbooks and were installed using the knife cookbook site commands. By including Dynamic Kernel Module Support (DKMS), VirtualBox Guest Additions should automatically rebuild themselves whenever the kernel is updated.
Make sure you have a Vagrant box named "base" (it can be whatever Linux distro you choose), and you should be good to clone this repo and go:
$ vagrant box list
base
$ git clone git://github.com/elasticdog/vagrant-init.git myproject
$ cd myproject/
$ vagrant up
Everything should be customized based on your requirements, as this is
only meant as a initial template and it's fairly specific to my own
preferred workflow. You can edit the provided Vagrantfile
to set
attributes for your own dotfiles repository.
node['dotfiles']['repository']
- the git repository to clonenode['dotfiles']['enable_submodules']
- if your repository uses submodules or notnode['dotfiles']['shell']
- the default shell for thevagrant
user
All of the included packages are specified in the vagrant_main
cookbook's default recipe, so start there if you want to make changes.
When using the knife
command, the contents of the generated cookbook
README and metadata files are configurable by editing <myproject>/.chef/knife.rb.
See knife cookbook create --help
for details.
- Arch Linux
- Debian, Ubuntu
- CentOS, Red Hat, Fedora
If something isn't working properly for your platform, let me know and I'll try and fix things up.
The recipes currently assume that your VM is using the standard vagrant
user with a home directory of /home/vagrant. If that becomes a problem
I'll make it customizable with JSON attributes.
The rbenv installation is specific to the vagrant
user (it is not
system-wide), so you may have to adjust your $PATH
environment variable
to include ${HOME}/.rbenv/bin
when using your own dotfiles.
There's currently an
issue with
the VirtualBox Guest Additions compiling via DKMS for CentOS 6.2. If you
update your kernel inside the VM and then attempt to run vagrant reload
,
it won't be able to mount the Chef cookbooks properly, and the provisioner
will fail. Manually recompiling the Guest Additions will fix it, so for
now you have to perform the following:
[vm] $ sudo yum update kernel
[vm] $ exit
[host] $ vagrant reload
...this should fail to provision, but the VM will still boot up, so:
[host] $ vagrant ssh
[vm] $ sudo /etc/init.d/vboxadd setup
[vm] $ exit
[host] $ vagrant reload
Copyright (c) 2011, Aaron Bull Schaefer
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.