VagrantTool - henk52/knowledgesharing GitHub Wiki

https://code.google.com/p/charm-development-scripts/wiki/VagranTool

Table of Contents

Create a vagrant base box

If this is a desktop thing, then set-up the vagrant file to allow graphical display. config.vm.boot_mode http://docs-v1.vagrantup.com/v1/docs/config/vm/boot_mode.html

  • Using the windows shell
    1. start a windows command shell.
    2. cd C:\Profiles\helplife\VirtualBox VMs\uvagrant\
    3. del package.box
    4. vagrant package --base uvagrant --output srv-ubuntu-precise64.box
  • Using cygwin shell
    1. cd ~/vagrant-tools/vagrant_boxes
    2. vagrant package --base u-dsk-vagrant --output dsk-ubuntu-precise64.box
      • The name given after --base name the machine has in virtual box.
  • Or
    1. bin/create_vagrant_base_box.pl --dstname rt-fedora-heisenbug64

Hosting your boxes locally

Creating a versioned box

upload your box

  1. rm srv-fedora-heisenbug64.box
  2. vagrant package --base FedoraBase20 --output srv-fedora-heisenbug64.box
  3. scp srv-fedora-heisenbug64.box [email protected]:/var/webstorage/vagrant
  4. create the .json file
Create the srv-fedora-heisenbug64.json
{
    "description": "Fedora 20 x86_64 server, with puppet.",
    "short_description": "Fedora 20 x86_64 server.",
    "name": "company/srv-fedora-heisenbug64",
    "versions": [{
        "version": "0.2.0",
        "status": "active",
        "description_html": "<p>Dev Environment</p>",
        "description_markdown": "Dev Environment",
        "providers": [{
            "name": "virtualbox",
            "url": "http:\/\/10.1.2.3/storage/vagrant/srv-fedora-heisenbug64.box"
        }]
    }]
}

Getting a box based on a json

  1. mkdir MyBox
  2. cd MyBox
  3. vagrant box add http://10.1.2.3/storage/vagrant/srv-fedora-heisenbug64.json
    • add the box to vagrant using the definition from srv-fedora-heisenbug64.json
    • (the box is actually downloaded here, so it can take a minute...or 10)
  4. vagrant init company/srv-fedora-heisenbug64
    • init the box (this creates a .vagrant folder and a Vagrantfile in the cwd with the appropriate box name)
  5. vagrant up
    • boot the box
Or write a Vagrantfile for use with the .json file
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "company/srv-fedora-heisenbug64"
  config.vm.box_url = "http://10.1.2.3/storage/vagrant/srv-fedora-heisenbug64.json"
end
⚠️ **GitHub.com Fallback** ⚠️