How best to implement basic horizontal scaling?

I'm writing a playbook as a learning exercise, with a narrow scope of
installing Gitorious and its dependencies on Ubuntu "Cloud" Precise amd64.
As part of the learning exercise, I wish to learn how best to do tiered
application playbooks.

Link to my Gitorious playbook repo:
https://gitorious.org/apb-gitorious/apb-gitorious

We talked about this on IRC, but nice ...

For example, I see Gitorious as entailing the following components:

a database for Gitorious (typically it's mysql, but I'm going to try
PostgreSQL)
SphinxSearch
a database for Gitorious (PostgreSQL again)
ActiveMQ
Gitorious + httpd + leftovers

While l honestly feel it inefficient to prematurely farm the five above
components out to separate machines (in my case it will be five m1.tiny
private OpenStack instances), my goal here is to learn how to assemble
tiered SaaS playbooks with parameters for horizontal scaling. As instances
are more granular, they are easier to load-balance in virtualization
environments. Other pros and cons occur to me about this sort of horizontal
scaling, but I suppose that is out of scope here. :slight_smile:

Basically you would have a playbook that defined each layer in the
system, that would include only the tasks needed on each.

This playbook would map those groups (i.e. control_sever) to the tasks
just the tier would perform.

The all in one playbook would just include more of the task and handler files.

The basic idiom I use is a "playbook maps groups of hosts to the roles
that they perform or steps that need to be run on those hosts".

Beyond the scaling out, I'd like the playbook I write for Gitorious to
easily scale back into an all-in-one install, for those who don't want or
need such scale. Installing OpenStack with Ansible is another target I have
in mind for this approach. In OpenStack there are many ways to assemble
such tiers.

At the moment, as an Ansible beginner, it seems best to define roles/tiers
for each component with a host group to bind them together. So, I'm
thinking instead of the "fooapp" or "webservers" in the best practices
example, I'd do roles: gitorious, sphinxsearch, postgresql, activemq. I'm
not sure how I'd handle two separate postgresql servers for the moment, but
my intent is to keep even those on discrete instances.

Please me know what you think and thanks for your time.

Sounds exactly right to me, though there is clearly plenty of options
of how to do it.