VMware Communities
stefanlasiewsk1
Enthusiast
Enthusiast

How can I use VMware Fusion to quickly deploy a set of VMs for a virtual "Computer Lab" environment on my laptop?

I use VMware Fusion to provide a virtual "Computer Lab" on my laptop, which I use to experiment with various pieces of software that require multiple nodes. However, provisioning these nodes is a bit of a pain. Today for example, I'd like to set up 3-5 nodes to test out Puppet Enterprise. Next week, I'd like to set up 3-5 nodes to test MySQL Cluster. Provisioning 3-5 nodes using the standard "load an ISO"-method [1] is going to be fairly time consuming.

Usually I'm just deploying Linux, but sometimes I want to deploy different OSes such as Windows, FreeBSD or CoreOS.


I have tried to set up my own Kickstart environment, but that's a bit of a pain to maintain. I have also tried cloning VMs, but this is a bit disorderly; and each time I need to go in and fudge with the MAC address and other unique identifiers in the VM.


Does VMware Fusion provide any tools which allow me to quickly provision and deploy sets of VMs in a short period of time?

[1] http://partnerweb.vmware.com/GOSIG/CentOS_6.html

Reply
0 Kudos
9 Replies
tracywang
Expert
Expert

Thanks for using Fusion. First I would like to confirm what is "unique identifiers" in the VM? What guest OS type?

For change Mac address while use link clone, you can generate a new Mac Address in VM settings -> Network Adapter -> Advanced options without power on the VM.

For the other things that you have to change in the guest, I suggest you try the vmrun command. Check the help by call vmrun in terminal. /Applications/VMware\ Fusion.app/Contents/Library/vmrun

Something like runScriptInGuest may help you.

Reply
0 Kudos
stefanlasiewsk1
Enthusiast
Enthusiast

> Thanks for using Fusion. First I would like to confirm what is "unique identifiers" in the VM? What guest OS type?

Currently I am working with Linux (CentOS). However as I mentioned earlier, I'm interested in a broader "deployment" solution which would quickly allow me to deploy multiple machines such as Windows 8, FreeBSD, etc. Can I quickly deploy 5 VMs if I have an ISO file, for example?

Regarding "Unique Identifiers" on CentOS specifically, if I clone an image, I often need to go into the clone and fix the MAC address on the host. On Windows and other OSes there might be other unique identifiers which cause problems after clong.

> For the other things that you have to change in the guest, I suggest you try the vmrun command.

Thank you for pointing that out. That command looks very helpful. I can probably write a script to quickly clone machines and the run commands inside the machine.

However, I'm not sure that I can get `runProgramInGuest` to run correctly. Shouldn't the following command echo "Hello" to my screen?

stefanl@maxosx:~ $ /Applications/VMware\ Fusion.app/Contents/Library/vmrun -T fusion -gu root runProgramInGuest ~/Documents/Virtual\ Machines.localized/host\ 1.vmwarevm/host\ 1.vmx  /bin/echo 'Hello'

Guest password:

stefanl@maxosx:~ $

Thank you,

-= Stefan

Reply
0 Kudos
stefanlasiewsk1
Enthusiast
Enthusiast

One solution I've tried for CentOS is to do the following.

  1. Create a clone "Master". On the clone master, remove the MAC address like this. More information can be found on ServerFault here: https://serverfault.com/questions/629640/when-cloning-a-vmware-virtual-machine-how-can-i-prevent-mac...
    1. I generally start with an image that is basic and generic.
    2. Remove the HWADDR and UUID lines from  /etc/sysconfig/network-scripts/ifcfg-eth0 . This removes any future conflict with clones created from this Clone Master.
    3. Delete the persistent network rules from UDEV. This step will need to be repeated any time that the Clone Master is rebooted again.
      1. `rm /etc/udev/rules.d/70-persistent-net.rules`
      2. Shutdown the Clone Master.
  2. Clone the Clone Master into new images.
    1. There is no MAC address conflict with /etc/sysconfig/network-scripts/ifcfg-eth0 (see step 1A above).
    2. When a clone is started, Linux will detect the new MAC address assigned to it by VMware Fusion, and UDEV will create a new /etc/udev/rules.d/70-persistent-net.rules file upon boot.
Reply
0 Kudos
wila
Immortal
Immortal

Hi,

Sounds to me you are looking for a product like Vagrant which I understand can do this type of thing while using VMware Fusion.

Eg. Vagrant

Note: that I have never used it myself, but this is what I would look at if I had your requirements.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
stefanlasiewsk1
Enthusiast
Enthusiast

Yes, Vagrant may be a solution but the connector for VMware costs $70 per seat.

I was hoping to maybe find a free way or using a standard VMware tool.

-= Stefan

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

Hmm.. if you don't have a budget for that then I'm guessing you are back to PXE boot followed by a post config.

It can do most -if not all- of what you're talking about.

Re. your question on vmrun and runProgramInGuest, the /bin/echo won't work because that should be started with a shell environment (eg. like bash as parent process) as otherwise there is no stdout set to echo on.

Instead your should try to write something to the file system instead for your experiment.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
stefanlasiewsk1
Enthusiast
Enthusiast

Thanks for the help.


Does anyone know if I can load an ISO from the commandline? I don't think I can do this using vmrun.

Reply
0 Kudos
wila
Immortal
Immortal

Hi,

That depends a bit on "load a ISO".

If you setup a VM without a bootable disk and you have a .iso connected then it should boot from that .iso file without additional actions when starting the VM.

However I'd guess you would still need to do some customisations then and that's basically where kickstart comes around the corner.

FWIW, if you run Fusion and install a well supported OS (for example Ubuntu 14.04.1 (probably also latest 14.04 not sure) then you can install it using easy install. Easy Install auto configures the VM for you after it gets your username/password and some optional info.

It does this via a script that is read via a floppy that is automounted on boot, at least that is how it used to work.

I'm seeing a floppy image "unattend.flp" in /Applications/VMware Fusion.app/Contents/Resources

That might be the windows one instead.

The thing I would look at -if not using PXE/Vagrant- is to run an autoinstall, then pause/suspend the VM and check if a floppy is mounted and attached to the VM.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Reply
0 Kudos
stefanlasiewsk1
Enthusiast
Enthusiast

FWIW, if you run Fusion and install a well supported OS (for example Ubuntu 14.04.1 (probably also latest 14.04 not sure) then you can install it using easy install. Easy Install auto configures the VM for you after it gets your username/password and some optional info.

It does this via a script that is read via a floppy that is automounted on boot, at least that is how it used to work.

Unfortunately the Easy Installs always install a Desktop GUI. I really just want the commandline.

I'm seeing a floppy image "unattend.flp" in /Applications/VMware Fusion.app/Contents/Resources

That might be the windows one instead.

The thing I would look at -if not using PXE/Vagrant- is to run an autoinstall, then pause/suspend the VM and check if a floppy is mounted and attached to the VM.

Cool, thanks for the tip. I'll look into that.

Overall, it looks like the simplest solution is to simply create an image and clone it as needed.

Reply
0 Kudos