Chef conditional execute in recipe

chef

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…

Best Answer

Go to: https://docs.chef.io/resources.html#guards

Look at the section titled "Conditional Execution"