- From: Sam Pointer <
>
- To:
- Subject: [chef] Re: Re: bootstrap a node through chefserver API in ruby file
- Date: Tue, 26 Feb 2013 18:57:00 +0000
This is what we do at EA, more-or-less. We poke the API of the cloud in question to do some peripheral configuration (security groups, EIP, etc.), poke the API to create a box, spin until the box is up, spin again until the IP assignment is all done, and then bootstrap the box via ssh.
We do all of this from within an asynchronous job in Rails, in pure ruby (no shell-out) by re-using the classes the chef and knife gems provide, alongside some custom stuff to talk to RightScale.
So, to give you an answer: you need to get inside the knife and Chef code, understand how they do what they do, and then re-use their classes as appropriate in your own code. Chef::Knife::Bootstrap in ./lib/chef/knife/bootstrap.rb (in your exploded gem) might be a good place to start. In simple terms, you need an appropriately populated Chef::Config and then you need to do something like:
bootstrap = Chef::Knife::Bootstrap.new
...
bootstrap.run
S.
On Tue, Feb 26, 2013 at 1:16 PM, Pete Cheslock
<
" target="_blank">
> wrote:
You could use the fog gem to provision an instance, but when the instance is available (via ssh), you'd have to have something run the bootstrap command to tell the node to provision with chef.
On Feb 26, 2013, at 5:26 AM, <
">
> wrote:
>
> hi,
> how to bootstrap a node in AWS,hp or openstack using chefserver API without
> workstation it means not using knife command.....i have to create a node in any
> provider and register with chefserver [through API only] in ruby ...if it is
> possible means pls post any sample code or any idea
>
> Thanks and Regards,
> Ganesan.A
Archive powered by MHonArc 2.6.16.