chef-apply is an executable program that runs a single recipe from the command line:
This command has the following syntax:
$ chef-apply name_of_recipe.rb
This tool has the following options:
-e RECIPE_TEXT
, --execute RECIPE_TEXT
-l LEVEL
, --log_level LEVEL
-s
, --stdin
-v
, --version
-W
, --why-run
-h
, --help
Run a recipe
Run a recipe named machinations.rb
:
$ chef-apply machinations.rb
Install Emacs
Run:
$ sudo chef-apply -e "package 'emacs'"
Returns:
Recipe: (chef-apply cookbook)::(chef-apply recipe) * package[emacs] action install - install version 23.1-25.el6 of package emacs
Install nano
Run:
$ sudo chef-apply -e "package 'nano'"
Returns:
Recipe: (chef-apply cookbook)::(chef-apply recipe) * package[nano] action install - install version 2.0.9-7.el6 of package nano
Install vim
Run:
$ sudo chef-apply -e "package 'vim'"
Returns:
Recipe: (chef-apply cookbook)::(chef-apply recipe) * package[vim] action install - install version 7.2.411-1.8.el6 of package vim-enhanced
Rerun a recipe
Run:
$ sudo chef-apply -e "package 'vim'"
Returns:
Recipe: (chef-apply cookbook)::(chef-apply recipe) * package[vim] action install (up to date)
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs-archive.chef.io/release/12-13/ctl_chef_apply.html