← 返回命令列表

Linux command

knife 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Bootstrap node

knife bootstrap [host] -x [user] -P [password]

List nodes

knife node list

Show node info

knife node show [node_name]

Upload cookbook

knife cookbook upload [cookbook]

Search nodes

knife search node "role:[webserver]"

SSH to nodes

knife ssh "role:[webserver]" "[command]"

说明

knife is the command-line tool for Chef infrastructure automation. It manages nodes, cookbooks, and Chef server. The tool bootstraps nodes for configuration management. It uploads recipes and queries infrastructure.

参数

bootstrap _HOST_
Bootstrap Chef on node.
node _CMD_
Node management.
cookbook _CMD_
Cookbook operations.
search _TYPE_ _QUERY_
Search Chef server.
ssh _QUERY_ _CMD_
Run command via SSH.
-x _USER_
SSH username.
--help
Display help information.

FAQ

What is the knife command used for?

knife is the command-line tool for Chef infrastructure automation. It manages nodes, cookbooks, and Chef server. The tool bootstraps nodes for configuration management. It uploads recipes and queries infrastructure.

How do I run a basic knife example?

Run `knife bootstrap [host] -x [user] -P [password]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does bootstrap _HOST_ do in knife?

Bootstrap Chef on node.