You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Erik Hollensbe e7df913bfd Remove debugging 7 years ago
CHANGELOG.md vmsh 0.3.1 7 years ago
README.md bride of readme cleanup 8 years ago
vmsh Remove debugging 7 years ago

README.md

VMSH: A VMWare alternative to complex VM managers

This tool aims to provide the same kind of functionality as tools like Vagrant only without the complexity.

VMSH installation is very simple and provides most of the features the author suspects are needed from vagrant, and the composability to do more as necessary. You can see the code here.

VMSH requires VMWare Fusion 6 and OS X, or VMWare Workstation 10 and Linux.

Installation

Put this in your shell profile...

. path/to/vmsh

...and reload your shell.

Commands

  • vm help - get help
  • vm list - list all running vms. Takes no arguments.
  • vm list_all - list all vms, running or not.
  • vm start <name> - start a vm
  • vm stop <name> - stop a vm
  • vm suspend <name> - suspend a vm (use vm start to start it again)
  • vm create <name> <base> - create a vm with as a clone of
  • vm destroy <name> - destroy a vm, will stop if running.
  • vm get_ip <name> - get the ip of a running VM.
  • vm_do - see the "vm_do" section below.

Base VM

To create and destroy VMs, you need a "base VM" to clone from. To build this:

  • Create your VM inside the VMWare Fusion GUI.
    • Creating a VM with spaces in the name will make it more complicated to use.
    • It's a good idea to create a custom network at this time with your preferred settings -- you can do so from the preferences.
  • Configure your VM to use the network method you prefer.
  • Start and install your guest operating system.
  • Install the VMWare tools. This is a critical part of the installation.
  • You may want to configure additional software at this time -- don't worry, VMSH doesn't judge.
  • It is a good idea to cleanly shutdown your VM at this time.

vm_do

vm_do is the core of how VMSH works. It is also a great way to add custom tooling.

vm_do takes at minimum two arguments: the command, and the name of the target VM to affect. It also communicates the exit status from vmrun, which is VMWare's internal tool. Example from vm_stop:

vm_stop() {
  echo "Starting VM ${1}"
  vm_do stop $1
  return $?
}

A provider

Vagrant has the notion of "providers", which are a great idea. Let's see how to do them in VMSH.

Here's a simple "knife bootstrap" provider for chef users:

vm_bootstrap() {
  # assuming our base VM is called `base`
  vm_create $1 base

  # ip address is available to us via the `vm get_ip` function, so use that.
  # my base box is set up with user 'ubuntu' password 'ubuntu', and it has a
  # role called 'base'
  knife bootstrap -N $1 $(vm get_ip $1) -x ubuntu --sudo -r 'role[base]'
}

Thanks!

Thanks for trying this! I hope you like it.