- From: Peter Donald <
>
- To:
- Subject: [chef] Re: How do you manage multiple data centers
- Date: Wed, 8 May 2013 08:59:02 +1000
Hi,
We currently only have 3 data centers so what we are doing may not
scale but ... what we essentially do is mark each node with a
'datacenter' attribute.
In some cases we explicitly set the data center attribute as part of
the environment, sometimes we discover it via ohai and sometimes we
derive it from the fqdn of the node. In all cases we have a recipe in
our base cookbook that verifies that the derived data center attribute
matches the explicitly set datacenter attribute. (This allows us to do
things like ensure that only nodes with a chef_environment of
'production' appear in the 'BWD' data center
Each datacenter has chef-managed local services and some have
externally managed services (sometimes coloured by environment as
well). For the first set of services we use search against nodes to
discover them and for the second set of services we either use search
against a data bag or we explicitly hardcode them in a recipe. In some
cases it is simple as
if 'BWD' == node['datacenter']
node.override['nameservers'] = ['1.1.1.1','2.2.2.2']
elsif '8NS' == node['datacenter']
node.override['nameservers'] = ['3.3.3.3]
elsif ...
Deciding on databag vs code - It mostly comes down to a pragmatic
decision on how often the data changes, how complex the derivation
rules are and who manages the change.
When we want pairs across datacenters then we typically also use
search with a 'NOT datacenter:#{node['datacenter']}" clause.
So far, so good. About the only negative is that sometimes differences
across datacenters get scattered through multiple cookbooks. I have
been thinking of adding a foodcritic rule in that highlights this
should be centralized into one place but have yet to do so.
On Wed, May 8, 2013 at 7:15 AM, Sascha Bates
<
>
wrote:
>
I'm about to embark on the multiple part of my multi-datacenter automation
>
project and am wondering how people are accomplishing this now?
>
>
I currently have environments that mimic code promotion: dev/test/prod
>
whatever.
>
>
My production environment is only used to pin cookbook versions and that's
>
how I ensure promotion is controlled, by bumping the version in my
>
environment.
>
>
Now that I'm approaching a situation where I need to make some design
>
decisions, I'm wondering how people are managing data that vary by location
>
and how they feel about what they're doing. I'm aware of most of the ways
>
to do something like this: environments, roles, data bags, whatevs, so I'm
>
not in need suggestions on what I should do, but am looking for how you like
>
what YOU'RE doing.
>
>
Thanks,
>
Sascha
--
Cheers,
Peter Donald
Archive powered by MHonArc 2.6.16.