-
Notifications
You must be signed in to change notification settings - Fork 17
Running Chef Recipes
chef-runner executes one or more recipes you pass on the command line, in the exact order given. The tool has a flexible recipe syntax allowing you to compose your run list in multiple ways.
-
Run local default recipe when passing no arguments:
$ chef-runner
-
Run local recipe when passing filename:
$ chef-runner recipes/foo.rb
-
Run local recipe when passing recipe name:
$ chef-runner ::foo
-
Run any recipe when passing cookbook name plus recipe name:
$ chef-runner dogs::bar $ chef-runner dogs # same as dogs::default
-
Run multiple recipes (of mixed type) in order given:
$ chef-runner recipes/foo.rb bar dogs::baz
-
Of course, standard Chef syntax is supported as well:
$ chef-runner recipe[cats],dogs::bar
Note: When defining recipes in a format other than 4), you must be inside a
cookbook directory with a metadata.rb
file for chef-runner to know the
cookbook's name.
Moreover, chef-runner allows you to load node attributes from a local JSON file:
$ chef-runner -j chef.json
You can also configure both output format and log level of Chef:
$ chef-runner -F doc -l warn
Last but not least, here is how to enable debug messages:
$ CHEF_RUNNER_LOG=debug chef-runner ...