There’s another little helper script I’d like to introduce: mt-vagrantnw

I fire up a number of test machines using Vagrant. Each machines gets an IP to be reachable. Sometimes, when I need a master-slave setup, these need to be in the same range. Other times I just quickly need an IP to dispense to an machine.

Especially the later groups brings me often in a situation, where I just pick an address similar to one I see in the Vagrant file. It happens, that this then is identical to one of the machines define further below. Great. What could go wrong.

So I brought up this simple helper script to parse the Vagrant file for IP addresses and list the associated machines with it. And vice-versa.

# Default output with sorted machine names.
$ mt-vagrantnw

Get the help with -h (like how to specify the vagrant file).

There’s a little bonus in there as well: If you’re using hiera, you can specify the location with

mt-vagrantnt::vagrantfile: /path/to/Vagrantfile

The code for the script it here.

The script runs in Ruby and requires the gem thor.