Some quick perspective since you've been working heavily with tools that
use different paradigms:
- Puppet is a declarative system where you create a type to do
repetitive work, connect resources with dependencies, and let the
interpreter guess what order to run commands.
- AutomateIt is an imperative system where you create methods to do
repetitive work, call these as needed, and organize code in the order
you want the interpreter to run it.
...
If I was doing the task you described, I'd create a top-level "all.rb"
recipe that calls all the other recipes.
In this top-level recipe, I'd invoke a bunch of generic recipes that
setup the basics of Apache, Passenger, PostgreSQL, etc, for this Rails
application server role, e.g.:
if tagged?(:rails_server)
invoke 'base_apache'
invoke 'base_passenger'
...
end
Towards the end of this "all.rb" recipe, I'd have it invoke a custom
recipe for setting up the individual Rails apps. If these Rails apps are
very similar, I'd create a method (via Ruby's lambda or file in the
project's "lib" directory) that I can call with arguments to do all the
repetitive work of creating each app's directories, databases, Apache
sites and such, e.g.:
setup_my_rails_app_for("staging") if tagged?(:rails_staging_server)
setup_my_rails_app_for("qa") if tagged?(:rails_qa_server)
...
You can see how I'm using a custom "apache_manager" to do the redundant
install/enable/reload work for setting up a default apache site:
http://github.com/igal/osbp_automateit/blob/master/recipes/my_apache.rb
And then in a Rails app:
http://github.com/igal/osbp_automateit/blob/master/recipes/my_bridgepdx_ocw.rb
And here's the ApacheManager library that I'm using to do this, look
particularly at the "install_site" method:
http://github.com/igal/osbp_automateit/blob/master/lib/apache_manager.rb
You'd basically want to write something a higher-level wrapper.
Does that make sense?
-igal