[chef] Re: How to tell if Chef is running?


Chronological Thread 
  • From: Joshua Timberman < >
  • To:
  • Subject: [chef] Re: How to tell if Chef is running?
  • Date: Mon, 24 Jan 2011 00:18:12 -0700

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ohai!

On Jan 23, 2011, at 10:54 PM, Noah Gibbs wrote:

> Is there a standard way to tell if your (ruby) code is being invoked 
> (indirectly) by a Chef run?  In this specific case the code is executing in 
> a RubyGems pre-install hook.

You can use 'shef' to debug recipes.

http://wiki.opscode.com/display/chef/Shef

> Semi-relatedly, Chef seems strongly aimed at being run to configure the 
> machine, and then mostly not run again on the same node except to add more 
> software.  For example, there aren't a lot of uninstall-based resources, I 
> don't see an obvious way to "reverse" a cookbook, few cookbooks seem 
> written to work incrementally or in stages, etc.  Is that pretty much how 
> it's intended, or am I missing something?

As stated by others already, you would have to write "undo" style recipes 
that call the opposite actions on the various resources.

> To be fair, I haven't come up with a good scenario yet for why you'd want 
> to run it on a more continuous basis (at least, not one where you couldn't 
> do it better in some other way).  But it's odd because a lot of the 
> individual resources seem to be kind of incremental in feel (specify how 
> many backups to make, specify that you're syncing the git repository rather 
> than just creating it, etc) -- almost as though they're meant for repeated 
> use as a deployment tool, for instance.  But the cookbooks don't seem to be 
> written the same way.  It's slightly confusing.


Dynamic infrastructure configurations that use a lot of search might want to 
ensure they're running on a somewhat continuous basis. For example, the 
Opscode Nagios cookbook[0] does a lot of searches based on roles and nodes. 
To ensure that all systems are monitored, you might run the chef-client on 
the Nagios server every 10 minutes. In environments that do application 
deployment with a Chef recipe[1], and practice continuous deployment, an 
interval may make sense as well.

In the case of cookbooks published by Opscode, we subscribe to the idea that 
infrastructure should be treated as disposable. It is generally[2] easier to 
simply terminate a VM/cloud instance and start a new one (in two commands, 
even), than it is to put effort into "undo" recipes, so our cookbooks do not 
have such recipes included.

[0]: http://cookbooks.opscode.com/cookbooks/nagios
[1]: http://cookbooks.opscode.com/cookbooks/application
[2]: John Vincent's users scenario is a good one to consider, we just haven't 
written similar in our own users cookbook, yet :-).

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iEYEARECAAYFAk09J7QACgkQO97WSdVpzT2b0gCeKxX9ryH5od6CFOch5Lw+E4Z+
ML0AoJmEGuN50S9KG28326+0RkUv+tr7
=VtQq
-----END PGP SIGNATURE-----



Archive powered by MHonArc 2.6.16.

§