For creating different types of machines, you can directly set `machine_options` as an attribute on `machine`:
require 'chef/provisioning/aws_driver'
with_driver 'aws::eu-west-1'
machine_batch ‘my cluster’ do machine ‘small’ do machine_options :bootstrap_options { instance_type: ‘m3.medium’ } end machine ‘large’ do machine_options :bootstrap_options { instance_type ‘c4.large’ } end end
If you are provisioning in AWS, you should also be using chef-provisioning-aws instead of chef-provisioning-fog.
The hash you set on :bootstrap_options can come from an attribute, set at a role or environment level.
Your provisioning run_list looks fine to me - what about running multiple recipes (a base recipe and different recipes for different machine sizes) makes you uncomfortable?
-T On Apr 10, 2015, at 6:47 AM, Gabriel Rosendorf <
" class="">
> wrote:
I'm also starting to look into chef-provisioning, and specifically chef-provisioning-aws. One thing that I've sort of struggled with is what that workflow is going to look like. The direction that I'm heading is this:
- Each deployment (collection of vpc, subnets, instances, etc) will reside in it's own chef repo, separate from where we store our normal cookbooks, environments, etc.
- Each region that we'll deploy to is represented as an environment, e.g. us-east-1.json.
- When we converge, we point chef-client to a cookbook and an environment, e.g. chef-client -z -o provisioning-cookbook -E us-west-2
This allows us to control attributes per region, subnet CIDRs for example. Also, since the outputs are stored as data bags, this method of using separate chef repos per deployment type keeps those separated in source control.
This is my first crack at chef-provisioning, so this may be a horrible idea of reasons that I haven't encountered yet, but for now it seems to make sense. I'd love to hear how other folks are doing it!
Best, Gabriel
On Thu, Apr 9, 2015 at 10:39 PM Christine Draper <
" class="">
> wrote: That's an interesting question. I've also been struggling with that separation.
Perhaps if the provisioning recipes were in a cookbook, then the machine_options to use for each node might be defined using attributes, and looked up and set on each machine. But I haven't tried it (so far only running with recipe files rather than a run list). Regards, Christine
|