- From: Daniel DeLeo <
>
- To:
- Subject: [chef] Re: Chef "execute" question
- Date: Mon, 21 Jul 2014 08:58:23 -0700
On Monday, July 21, 2014 at 8:39 AM, Justin Franks wrote:
>
Let's say I have:
>
execute "something" do
>
command "/usr/local/bin/somescript"
>
action :run
>
end
>
Will Chef execute that command on every client run? If not how do I make it
>
execute the command on each client run?
There’s two common ways to do this, depending on what you need. If you need
this to execute in response to a change in a different resource, such as a
file being updated or a service restarted, then you want to use `action
:nothing` and have the other resource notify your execute resource to run.
See:
http://docs.opscode.com/resource_common.html#notifications
If your execute resource is more like a “poor man’s LWRP”, that is, it
independently manages some system state unrelated to other resources, then
you can use a guard command to make the execution conditional based on
results of that command. See:
http://docs.opscode.com/resource_common.html#guards
>
>
>
>
>
>
*************************
>
Justin Franks
>
Lead Operations Engineer
>
SaaS, Cloud, Data Centers & Infrastructure
>
Lithium Technologies, Inc
>
225 Bush St., 15th Floor
>
San Francisco, CA 94104
>
tel: +1 415 757 3100 x3219
HTH,
--
Daniel DeLeo
Archive powered by MHonArc 2.6.16.