Leveraging node data for one-off commands


#1

All,

What’s the best way to leverage chef data bags to launch something that does a one-off command on select nodes?

Thanks,
Ken

P.S.

– from this point on are clues about what that question is asking –

In the past there were articles about using searches on Puppet stored configs to create lists of hosts that were fed into Capistrano.
http://www.robinbowes.com/article.php/2009100402131050

I’m not “married” to using Capistrano so my question is asked in a more generic way at the top of this message.

The idea of writing a recipe that would be used once seems to me to be a bit heavyweight.


#2

On Wed, Dec 29, 2010 at 1:03 PM, Kenneth Stailey kstailey@yahoo.com wrote:

What’s the best way to leverage chef data bags to launch something that does a one-off command on select nodes?

I wrote up an answer as a blog post:
http://blog.loftninjas.org/2010/12/29/knife-one-liners/

If that doesn’t answer your question, can you be more specific as to
what kind of conditional you’re looking for? Since data bags aren’t
tied to specific nodes, you’ll need some way to connect the data bag
items your search returns with a list of nodes, which is going to be
dependent on your particular setup.

Bryan


#3

An example of a one-time use recipe is the radiant::db_bootstrap
recipe. The main trick here is that the recipe removes itself from the
node’s run list at the end.

https://github.com/opscode/cookbooks/blob/master/radiant/recipes/db_bootstrap.rb

If you’re setting up, for example, a lot of Radiant CMS sites, then it
can be handy to automate that.

On Wed, Dec 29, 2010 at 2:03 PM, Kenneth Stailey kstailey@yahoo.com wrote:

All,

What’s the best way to leverage chef data bags to launch something that does a one-off command on select nodes?

Thanks,
Ken

P.S.

– from this point on are clues about what that question is asking –

In the past there were articles about using searches on Puppet stored configs to create lists of hosts that were fed into Capistrano.
http://www.robinbowes.com/article.php/2009100402131050

I’m not “married” to using Capistrano so my question is asked in a more generic way at the top of this message.

The idea of writing a recipe that would be used once seems to me to be a bit heavyweight.


Opscode, Inc
Joshua Timberman, Technical Evangelist
IRC, Skype, Twitter, Github: jtimberman