Use the knife deps subcommand to identify dependencies for a node, role, or cookbook.
This subcommand has the following syntax:
$ knife deps (options)
Note
Review the list of common options available to this (and all) knife subcommands and plugins.
This subcommand has the following options:
--chef-repo-path PATHchef_repo_path in client.rb.--concurrency10.--[no-]recurse--recurse to list dependencies recursively. This option can only be used when --tree is set to true. Default: --no-recurse.--remotefalse.--repo-mode MODEstatic, everything, or hosted_everything. Use static for just roles, environments, cookbooks, and data bags. By default, everything and hosted_everything are dynamically selected depending on the server type. Default: everything / hosted_everything.--treefalse.Note
See knife.rb for more information about how to add certain knife options as settings in the knife.rb file.
The following examples show how to use this knife subcommand:
Find dependencies for a node
$ knife deps nodes/node_name.json
Find dependencies for a role
$ knife deps roles/role_name.json
Find dependencies for a cookbook
$ knife deps cookbooks/cookbook_name.json
Find dependencies for an environment
$ knife deps environments/environment_name.json
Find dependencies for a combination of nodes, roles, and so on
To find the dependencies for a combination of nodes, cookbooks, roles, and/or environments:
$ knife deps cookbooks/git.json cookbooks/github.json roles/base.json environments/desert.json nodes/mynode.json
Use a wildcard
A wildcard can be used to return all of the child nodes. For example, all of the environments:
$ knife deps environments/*.json
Return as tree
Use the --tree option to view the results with structure:
$ knife deps roles/webserver.json
to return something like:
roles/webserver.json
roles/base.json
cookbooks/github
cookbooks/git
cookbooks/users
cookbooks/apache2 Pass knife deps output to knife upload
The output of knife deps can be passed to knife upload:
$ knife upload `knife deps nodes/*.json
Pass knife deps output to knife xargs
The output of knife deps can be passed to knife xargs:
$ knife deps nodes/*.json | xargs knife upload
© 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/knife_deps.html