Are there any best practices that have emerged around executing ad-hoc
tasks via Chef? A use case that seems to come up often for me is performing
code deployments using the application cookbook without executing any other
configuration tasks that would usually be executed by the run_list. I
understand that with Chef one typically considers a deployment to be
inclusive of the prerequisite package installations, etc., but humor me for
a bit.
Anyway, a couple of ways that I thought the above might be handled are to
either set the run_list on the fly prior to the chef-client run, or to
execute chef-client on the target nodes with the -j option, passing it an
ad hoc run_list in the JSON. The former would require the previous run_list
to be saved, then restored after the chef-client run (assuming it is
successful). The latter appears to set the run_list on the Chef server
after the chef-client run. Both options seem to make it difficult to use
the nodes’ run_list settings on the Chef server as a source of truth for a
node’s function, so I’m not really happy with either one.
I’d love to hear how you all have handled the above problem. Or maybe I’m
just looking at this the wrong way? In any case, thanks in advance for any
advice.
Also on this topic, I noticed the following on
http://wiki.opscode.com/display/chef/FAQ:
"…by making Chef’s Resourceshttp://wiki.opscode.com/display/chef/Resources
capable of taking action from ad-hoc sources. (This isn’t released yet,
but it will be soon - and trust us, it is awesome.)"
The above seems promising for the use case I described, and is interesting
in general. Can anyone provide any more detail on this? Thanks everyone!