0

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...

viraptor
  • 1,296
  • 6
  • 21
  • 41
  • 1
    The 'guards' 'not_if' and 'only_if' will only execute a resource if a script returns true. https://docs.chef.io/resource_execute.html – spuder Jun 13 '15 at 03:45

1 Answers1

5

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

Look at the section titled "Conditional Execution"

mmell
  • 121
  • 4
Phenux
  • 66
  • 1