Mapping applications to VMs

I use XEN in RedHat linux (CentOS) for our QA environment. Within each XEN server I might have 20 – 30 servers.
There are three XEN servers per QA environment, three QA environments.
A constant problem is tracking where applications are installed within the VMs.

I use puppet throughout the environments, including deployments of applications to VMs.
The main puppet file, the file that kicks everything into operation, is the nodes.pp file.
It turns out nodes.pp is also usually the most current and accurate source for information on
what is installed where. Puppet configurations are kept in subversion (soon to be moved to git).

The best mapping of application to VM can be found in puppet by querying nodes.pp file(s)
in the local sandbox. Here is what I am using.

Put this in ~/.bashrc, replacing “” with where your sandbox lives…

function FindinNodes {

grep --color=auto $1 /trunk/puppet_config/*/etc/puppet/manifests/nodes.pp

}

The first time after you do this, run:

source ~/.bashrc

After that you can query nodes.pp by running the following function.
This will give you all of the hostnames that have testapp installed:

FindinNodes testapp

Searching for such information takes less than a second. IP info would be an additional step,
running nslookup or dig…

—doug