This document discusses how to programmatically create and maintain a Jenkins instance (which is normally done by an administrator in a typical single-deployment scenario.) This is for a large organization that needs to manage a large number of Jenkins installations, or perhaps a hosting environment that provides Jenkins as a service.
Installing a new instance
Installing a new instance of Jenkins is just a matter of deploying Jenkins into an application server, so much of the automation depends on the container of your choice. You can also choose to run Jenkins as "
java -jar jenkins.war" and use embedded Winstone, although the scalability of Winstone hasn't been widely tried yet.
The only information Jenkins needs when launching is
JENKINS_HOME — a directory that Jenkins uses to store all the data. See Administering Jenkins for how to pass in this information. You can programmatically create such a directory and fill it with the data files to start Jenkins in a pre-configured state that fits your environment. The easiest way to do this is to run Jenkins once manually and configure it to a desired state, and grab its data file as a template. You should also be able to just look at the files and figure out what they mean.