Bootstrap a node through chefserver API in ruby file


#1

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


#2

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, ganesan15785@gmail.com 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


#3

This gem might help you out for what you’re asking for:


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com (http://nepalonrails.tumblr.com)
http://funsole.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, February 26, 2013 at 7:01 PM, Pete Cheslock 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, <ganesan15785@gmail.com (mailto:ganesan15785@gmail.com)> 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


#4

This is a work-in-progress project I have to rewrite the bootstrapping process for knife. The code should be a good reference:


Daniel DeLeo

On Tuesday, February 26, 2013 at 7:41 AM, Sachin Sagar Rai wrote:

This gem might help you out for what you’re asking for:

https://github.com/reset/ridley#bootstrapping-nodes


@millisami
~ Sachin Sagar Rai
Ruby on Rails Developer
http://tfm.com.np
http://nepalonrails.com (http://nepalonrails.tumblr.com)
http://funsole.com
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Tuesday, February 26, 2013 at 7:01 PM, Pete Cheslock 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, <ganesan15785@gmail.com (mailto:ganesan15785@gmail.com)> 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


#5

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 petecheslock@gmail.comwrote:

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, ganesan15785@gmail.com 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