blob: 1b60177d1615a90a219d2df1c29163de46843ff5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
knife-exec(1) -- 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 chef-shell(1) DSL. See the chef-shell 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
__chef-shell(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://docs.chef.io>
|