Generating/managing config files for hosted application
I think you could use Bcfg2 very successfully for this. It is a configuration management system that is incredibly flexible and extendable. It comes with Genshi for basic templating logic, but allows arbitrary inline Python code to do more complicated stuff.
You could have a single database that contains all information about every instance, and then set up Bcfg2 to generate every bit of configuration based on that. As an added bonus, if you ever have to change something across a large number of instances (or all instances), it will be totally painless.