Passing parameters via knife bootstrap?

I’d like to pass some parameters on the command line to knife ec2
bootstrap… that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?


Mark J. Reed markjreed@gmail.com

I'd also like to see this option available.
@Mark - I've looked previously and have been unable to find anything.

On Wed, Aug 11, 2010 at 12:56 PM, Mark J. Reed markjreed@gmail.com wrote:

I'd like to pass some parameters on the command line to knife ec2
bootstrap... that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?

--
Mark J. Reed markjreed@gmail.com

--
Charles Sullivan
charlie.sullivan@gmail.com

Thanks, Charles.

In a related query, it appears that the node id is not one of the
pieces of information available in the @node object in a template?
How can I get at that information?

On Wed, Aug 11, 2010 at 2:14 PM, Charles Sullivan
charlie.sullivan@gmail.com wrote:

I'd also like to see this option available.
@Mark - I've looked previously and have been unable to find anything.

On Wed, Aug 11, 2010 at 12:56 PM, Mark J. Reed markjreed@gmail.com wrote:

I'd like to pass some parameters on the command line to knife ec2
bootstrap... that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?

--
Mark J. Reed markjreed@gmail.com

--
Charles Sullivan
charlie.sullivan@gmail.com

--
Mark J. Reed markjreed@gmail.com

On Wed, Aug 11, 2010 at 7:14 PM, Charles Sullivan
charlie.sullivan@gmail.com wrote:

I'd also like to see this option available.
@Mark - I've looked previously and have been unable to find anything.

I wouldnt mind stdin either / or

On Wed, Aug 11, 2010 at 12:56 PM, Mark J. Reed markjreed@gmail.com wrote:

I'd like to pass some parameters on the command line to knife ec2
bootstrap... that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?

--
Mark J. Reed markjreed@gmail.com

--
Charles Sullivan
charlie.sullivan@gmail.com

I've actually done a little bit of work on something like this:

Although it's nowhere near being immediately usable for the public. The problem that we were having is that we had nodes that were being spun up on an internal cloud and given a random mac address. We wanted to pass attributes via knife and then have that json blob be accessible from inside the node when it had spun up so we could pass it to chef-solo for initial configuration.

While we're not using EC2 at the moment for this, but an internal xenserver pool, we created a baseline that all nodes would be cloned from and setup to do a curl -s http://buildserver/chef/imprint | /bin/sh. That imprint script is :

Since the baseline image was configured to set its hostname to something based off its mac address, we were able to have a key-document relationship. Waitress essentially provides a sinatra based interface to a redis backend where that json blob (and mac address) can be stored, and then waits for a node to spin up and issue a GET for its hostname (which happens to be the node's mac address).

So, the tl;dr:
I know what you're talking about and see the value in why you want to do it. Here's how we've approached something similar and I hope it helps.

--
Ryan C. Creasey
Principal Systems Engineer
Technology Operations
IGN Entertainment

On Aug 11, 2010, at 11:14 AM, Charles Sullivan wrote:

I'd also like to see this option available.
@Mark - I've looked previously and have been unable to find anything.

On Wed, Aug 11, 2010 at 12:56 PM, Mark J. Reed markjreed@gmail.com wrote:
I'd like to pass some parameters on the command line to knife ec2
bootstrap... that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?

--
Mark J. Reed markjreed@gmail.com

--
Charles Sullivan
charlie.sullivan@gmail.com

You can specify arbitrary bootstrap templates to knife with the -d flag.
It'll look in ~/.chef/bootstrap.

Right now its hardcoded to default to "ubuntu10.04-gems.erb", which
you can find here:

http://github.com/opscode/chef/tree/master/chef/lib/chef/knife/bootstrap/

-s

On Wed, Aug 11, 2010 at 2:35 PM, Ryan C. Creasey rcreasey@ign.com wrote:

I've actually done a little bit of work on something like this:
GitHub - rcreasey/waitress: A JSON proxy for Chef used to match a newly spawned vm with its future node json
Although it's nowhere near being immediately usable for the public. The
problem that we were having is that we had nodes that were being spun up on
an internal cloud and given a random mac address. We wanted to pass
attributes via knife and then have that json blob be accessible from inside
the node when it had spun up so we could pass it to chef-solo for initial
configuration.
While we're not using EC2 at the moment for this, but an internal xenserver
pool, we created a baseline that all nodes would be cloned from and setup to
do a curl -s http://buildserver/chef/imprint | /bin/sh. That imprint
script is :
imprint.sh · GitHub
Since the baseline image was configured to set its hostname to something
based off its mac address, we were able to have a key-document relationship.
Waitress essentially provides a sinatra based interface to a redis backend
where that json blob (and mac address) can be stored, and then waits for a
node to spin up and issue a GET for its hostname (which happens to be the
node's mac address).
So, the tl;dr:
I know what you're talking about and see the value in why you want to do it.
Here's how we've approached something similar and I hope it helps.

Ryan C. Creasey
Principal Systems Engineer
Technology Operations
IGN Entertainment
On Aug 11, 2010, at 11:14 AM, Charles Sullivan wrote:

I'd also like to see this option available.
@Mark - I've looked previously and have been unable to find anything.

On Wed, Aug 11, 2010 at 12:56 PM, Mark J. Reed markjreed@gmail.com wrote:

I'd like to pass some parameters on the command line to knife ec2
bootstrap... that will be visible to the recipes in the run list;
ideally, a JSON blob that wound up as the argument to chef-client -j
would be perfect, but any way to get an arbitrary string somewhere a
recipe can see it would be great. Is there such a mechanism?

--
Mark J. Reed markjreed@gmail.com

--
Charles Sullivan
charlie.sullivan@gmail.com

Sean,

On 11 August 2010 22:22, Sean OMeara someara@gmail.com wrote:

You can specify arbitrary bootstrap templates to knife with the -d flag.
It'll look in ~/.chef/bootstrap.

Right now its hardcoded to default to "ubuntu10.04-gems.erb", which
you can find here:

http://github.com/opscode/chef/tree/master/chef/lib/chef/knife/bootstrap/

knife bootstrap in 0.9.6 was able to do it's work from a sudo-capable
user account. The 0.9.8 bootstrap templates seem to be written with
real root access in mind. Is there something I'm missing here, or
should the template scripts be updated with sudo support?

Ringo

knife bootstrap in 0.9.8 worked fine for me via sudo; just pass the
--sudo option to the bootstrap command.

On Mon, Aug 16, 2010 at 3:18 AM, Ringo De Smet ringo.desmet@gmail.com wrote:

Sean,

On 11 August 2010 22:22, Sean OMeara someara@gmail.com wrote:

You can specify arbitrary bootstrap templates to knife with the -d flag.
It'll look in ~/.chef/bootstrap.

Right now its hardcoded to default to "ubuntu10.04-gems.erb", which
you can find here:

http://github.com/opscode/chef/tree/master/chef/lib/chef/knife/bootstrap/

knife bootstrap in 0.9.6 was able to do it's work from a sudo-capable
user account. The 0.9.8 bootstrap templates seem to be written with
real root access in mind. Is there something I'm missing here, or
should the template scripts be updated with sudo support?

Ringo

--
Mark J. Reed markjreed@gmail.com

Mark,

On 16 August 2010 15:23, Mark J. Reed markjreed@gmail.com wrote:

knife bootstrap in 0.9.8 worked fine for me via sudo; just pass the
--sudo option to the bootstrap command.

Is this also a new option since 0.9.8? I must have missed this one.

Tnx for highlighting it...

Ringo