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::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::Bootstrap.new
On Tue, Feb 26, 2013 at 1:16 PM, Pete Cheslock email@example.com:
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, firstname.lastname@example.org wrote:
how to bootstrap a node in AWS,hp or openstack using chefserver API
workstation it means not using knife command…i have to create a node
provider and register with chefserver [through API only] in ruby …if
possible means pls post any sample code or any idea
Thanks and Regards,