Cloud Foundry has a number of roles and services it needs in order to support its PaaS. Some of the process steps are in the following readme.
More steps are in the RightScale template, although I'm not sure licensing would permit reusing this
this is going to take some work. here's a slightly better cut of the README file, but there are steps that require manual input (inside vcap_setup, which probably should be broken up into separate functions)
here's a cookbook that seems on the way: