fr33jc / bang

The beginning of the universe...
GNU General Public License v3.0
22 stars 7 forks source link

Bang doesn't allow multi-az deployment #5

Closed sjmc7 closed 11 years ago

sjmc7 commented 11 years ago

It would be nice if bang was able to run across availability zones (and regions, though that likely involves other infrastructure work). As a suggestion, it could be given a list of availability zones and attempt, where possible, to balance servers evenly among them when new servers are required.

From a quick look, it would make sense if the availability zones and region(s) could be specified for the stack (instead of per host group). Bang could then figure out which servers and where.

There shouldn't be any networking issues for bang to deal with, since it deals with external IPs only.

sjmc7 commented 11 years ago

After some thought, this is possible by defining multiple sets of the same config (different region/az/instance count) and reworking bang to do it itself is non-trivial. What would be useful instead is some idea of templating to reduce the duplication:

server-templates:
  some-purpose:
    groups:
    - testhosts
    provider: aws
    instance_type: standard.small
    .....

servers:
  some-purpose-az1:
    template: some-purpose
    instance_count: 1
    availability_zone: az.1-region-1
    ....

  some-purposes-az2
    template: some-purpose
    instance_count: 1
    availability_zone: az.1-region-1
    ....

There's a slight risk of server id overlaps in the current code - there might be a minor change required to include the region/az in the in-memory inventory for purposes of uniqueness.

sjmc7 commented 11 years ago

YAML aliasing allows this already. Closing.

server-templates:
  some-purpose: &some-purpose-base
    groups:
    - testhosts
    provider: aws
    instance_type: standard.small
    instance_count: 1
    .....

servers:
  some-purpose-az1:
    <<: *some-purpose-base
    availability_zone: az.1-region-1
    ....

  some-purposes-az2
    <<: *some-purpose-base
    availability_zone: az.2-region-1
    ....