Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to create an execute block which is only run when some specific condition is met (in this case if an interface wlan0 is present). Alternatively, I'd like to prevent the notifies clause of a template on the same condition.

How can I describe that in a recipe? I could of course put the whole condition in the execute's command, but I hope there's a better way to achieve this...

share|improve this question
1  
The 'guards' 'not_if' and 'only_if' will only execute a resource if a script returns true. docs.chef.io/resource_execute.html –  spuder Jun 13 at 3:45

1 Answer 1

up vote 3 down vote accepted

Go to: http://wiki.opscode.com/display/chef/Resources

Look at the section titled "Conditional Execution"

share|improve this answer
2  
That no longer exists. –  William Pietri Apr 28 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.