Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Running Chef Recipes

mlafeldt edited this page Dec 23, 2014 · 3 revisions

Recipe Syntax

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.

  1. Run local default recipe when passing no arguments:

    $ chef-runner

  2. Run local recipe when passing filename:

    $ chef-runner recipes/foo.rb

  3. Run local recipe when passing recipe name:

    $ chef-runner ::foo

  4. Run any recipe when passing cookbook name plus recipe name:

    $ chef-runner dogs::bar $ chef-runner dogs # same as dogs::default

  5. Run multiple recipes (of mixed type) in order given:

    $ chef-runner recipes/foo.rb bar dogs::baz

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

Misc.

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 ...
Clone this wiki locally