I wrote a script!

For me, this is a big deal. I’ve never been a sysadmin, but I talk with sysadmins all the time. Today I feel like I earned a little bit of street cred. I run a 3PAR simulator on my laptop to show demos to my customers. The simulator runs in 3 VMs that have to be booted in a certain order while passing commands through the shell. Not a big deal, and not really a pain. But suppose I’m in a meeting and the customer asks to see the GUI. Wouldn’t it be simpler to execute a single command, and let everything go on in the background? I think so, so that’s what I set out to do.

Queue learning how to do it. Since this will run off of my laptop, running windows 7, I need something that I can do from windows. Good thing there are some strong PowerShell cmdlets for VMware Workstation and SSH.

I used POSH-SSH to manage my SSH connections to the VMs and vmxtookit to do the VM power management.

So what does this street cred generating script do? Not much really, but it is still so cool! There are actually two scripts, one to start the simulator, and one to shut it down.

The startup script:

  1. Calls the vmxtoolkit to startup the controller VM.
  2. Open an SSH and pass command to start daemon.
  3. Start the two node VMs.

The Shutdown Script:

  1. SSH  to node VM
  2. Executes shutdown command
  3. Stop node VMs
  4. SSH to controller VM
  5. Pass command to stop daemon and shutdown

Like I said super simple. It doesn’t follow best practices for security. The scripts has passwords in plain text. I had a lot of fun, and got super frustrated at times. There are definitely some things I can do to streamline it, but I thought I’d share my experience and my code.

Code on GitHub