NAME¶
knife-exec - Run user scripts using the Chef API DSL
SYNOPSIS¶
knife exec (options)
- -E, --exec CODE
- Provide a snippet of code to evaluate on the command
line
DESCRIPTION¶
knife exec runs arbitrary ruby scripts in a context similar to that of
the
shef(1) DSL. See the shef documentation for a description of the commands
available.
EXAMPLES¶
- Make an API call against an arbitrary endpoint
- knife exec -E
´api.get("nodes/fluke.localdomain/cookbooks")´
=> list of cookbooks for the node fluke.localdomain
- Remove the role obsolete from all nodes
- knife exec -E ´nodes.transform(:all){|n|
n.run_list.delete("role[obsolete]")}´
- Generate the expanded run list for hosts in the
webserver role
- knife exec -E ´nodes.find(:roles =>
"webserver") {|n| n.expand!; n[:recipes]}´
SEE ALSO¶
shef(1)
AUTHOR¶
Chef was written by Adam Jacob
adam@opscode.com with many contributions
from the community.
DOCUMENTATION¶
This manual page was written by Joshua Timberman
joshua@opscode.com.
Permission is granted to copy, distribute and / or modify this document under
the terms of the Apache 2.0 License.
CHEF¶
Knife is distributed with Chef.
http://wiki.opscode.com/display/chef/Home