Vagrant#

A collection of commands for typical Vagrant use cases. Environment:

  • Vagrant 1.7.2

  • Ubuntu 14.04 as Base

  • Salt for provisioning

Creating and Using a Base Image with Salt Installed#

First create a Vagrantfile

 1# -*- mode: ruby -*-
 2# vi: set ft=ruby :
 3
 4Vagrant.configure(2) do |config|
 5
 6    config.vm.box = "ubuntu/trusty64"
 7    # vagrant uses this name in its output
 8    config.vm.define "trusty64-salt"
 9
10    config.vm.provider "virtualbox" do |v|
11      # the name in the Virtualbox GUI
12      v.name = "trusty64-salt"
13      v.memory = 2048
14      v.cpus = 4
15    end
16
17    # installs salt
18    config.vm.provision :salt do |salt|
19      salt.run_highstate = false
20    end
21
22    # leave the official insecure key be - we want a base image
23    # see http://docs.vagrantup.com/v2/boxes/base.html
24
25    config.ssh.insert_key = false
26
27end

Create it:

vagrant up

Package it:

vagrant package --base trusty64-salt

Add it locally:

vagrant box add package.box --name trusty64-salt

Use it in another Vagrantfile, e.g.:

config.vm.box = "trusty64-salt"