.TH "KNIFE-NODE" "1" "Chef 11.10.0" "" "knife node" .SH NAME knife-node \- The man page for the knife node subcommand. . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .\" Man page generated from reStructuredText. . .sp A node is any physical, virtual, or cloud machine that is configured to be maintained by a chef\-client. .sp The \fBknife node\fP subcommand is used to manage the nodes that exist on a server. .SH COMMON OPTIONS .sp The following options may be used with any of the arguments available to the \fBknife node\fP subcommand: .INDENT 0.0 .TP .B \fB\-\-chef\-zero\-port PORT\fP The port on which chef\-zero will listen. .TP .B \fB\-c CONFIG_FILE\fP, \fB\-\-config CONFIG_FILE\fP The configuration file to use. .TP .B \fB\-d\fP, \fB\-\-disable\-editing\fP Indicates that $EDITOR will not be opened; data will be accepted as\-is. .TP .B \fB\-\-defaults\fP Indicates that Knife will use the default value, instead of asking a user to provide one. .TP .B \fB\-e EDITOR\fP, \fB\-\-editor EDITOR\fP The $EDITOR that is used for all interactive commands. .TP .B \fB\-E ENVIRONMENT\fP, \fB\-\-environment ENVIRONMENT\fP The name of the environment. When this option is added to a command, the command will run only against the named environment. .TP .B \fB\-F FORMAT\fP, \fB\-\-format FORMAT\fP The output format: \fBsummary\fP (default), \fBtext\fP, \fBjson\fP, \fByaml\fP, and \fBpp\fP. .TP .B \fB\-h\fP, \fB\-\-help\fP Shows help for the command. .TP .B \fB\-k KEY\fP, \fB\-\-key KEY\fP The private key that Knife will use to sign requests made by the API client to the server. .TP .B \fB\-\-[no\-]color\fP Indicates whether colored output will be used. .TP .B \fB\-\-print\-after\fP Indicates that data will be shown after a destructive operation. .TP .B \fB\-s URL\fP, \fB\-\-server\-url URL\fP The URL for the server. .TP .B \fB\-u USER\fP, \fB\-\-user USER\fP The user name used by Knife to sign requests made by the API client to the server. Authentication will fail if the user name does not match the private key. .TP .B \fB\-V\fP, \fB\-\-verbose\fP Set for more verbose outputs. Use \fB\-VV\fP for maximum verbosity. .TP .B \fB\-v\fP, \fB\-\-version\fP The version of the chef\-client. .TP .B \fB\-y\fP, \fB\-\-yes\fP Indicates that the response to all confirmation prompts will be "Yes" (and that Knife will not ask for confirmation). .TP .B \fB\-z\fP, \fB\-\-local\-mode\fP Indicates that the chef\-client will be run in local mode, which allows all commands that work against the server to also work against the local chef\-repo. .UNINDENT .SH BULK DELETE .sp The \fBbulk delete\fP argument is used to delete one or more nodes that match a pattern defined by a regular expression. The regular expression must be within quotes and not be surrounded by forward slashes (/). .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node bulk delete REGEX .ft P .fi .sp \fBOptions\fP .sp This command does not have any specific options. .sp \fBExamples\fP .sp Use a regular expression to define the pattern used to bulk delete nodes: .sp .nf .ft C $ knife node bulk delete "^[0\-9]{3}$" .ft P .fi .sp Type \fBY\fP to confirm a deletion. .SH CREATE .sp The \fBcreate\fP argument is used to add a node to the server. Node data is stored as JSON on the server. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node create NODE_NAME .ft P .fi .sp \fBOptions\fP .sp This command does not have any specific options. .sp \fBExamples\fP .sp To add a node, enter: .sp .nf .ft C $ knife node create node1 .ft P .fi .sp In the $EDITOR enter the node data in JSON: .sp .nf .ft C ## sample: { "normal": { }, "name": "foobar", "override": { }, "default": { }, "json_class": "Chef::Node", "automatic": { }, "run_list": [ "recipe[zsh]", "role[webserver]" ], "chef_type": "node" } .ft P .fi .sp When finished, save it. .SH DELETE .sp The \fBdelete\fP argument is used to delete a node from the server. .IP Note Deleting a node will not delete any corresponding API clients. .RE .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node delete NODE_NAME .ft P .fi .sp \fBOptions\fP .sp This command does not have any specific options. .sp \fBExamples\fP .sp .nf .ft C $ knife node delete node_name .ft P .fi .SH EDIT .sp The \fBedit\fP argument is used to edit the details of a node on a server. Node data is stored as JSON on the server. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node edit NODE_NAME (options) .ft P .fi .sp \fBOptions\fP .sp This argument has the following options: .INDENT 0.0 .TP .B \fB\-a\fP, \fB\-\-all\fP Displays a node in the $EDITOR. By default, attributes that are default, override, or automatic are not shown. .UNINDENT .sp \fBExamples\fP .sp To edit the data for a node named "node1", enter: .sp .nf .ft C $ knife node edit node1 \-a .ft P .fi .sp Update the role data in JSON: .sp .nf .ft C ## sample: { "normal": { }, "name": "node1", "override": { }, "default": { }, "json_class": "Chef::Node", "automatic": { }, "run_list": [ "recipe[devops]", "role[webserver]" ], "chef_type": "node" } .ft P .fi .sp When finished, save it. .SH FROM FILE .sp The \fBfrom file\fP argument is used to create a node using existing node data as a template. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node from file FILE .ft P .fi .sp \fBOptions\fP .sp This command does not have any specific options. .sp \fBExamples\fP .sp To add a node using data contained in a JSON file: .sp .nf .ft C $ knife node from file "path to JSON file" .ft P .fi .SH LIST .sp The \fBlist\fP argument is used to view all of the nodes that exist on a server. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node list (options) .ft P .fi .sp \fBOptions\fP .sp This argument has the following options: .INDENT 0.0 .TP .B \fB\-w\fP, \fB\-\-with\-uri\fP Indicates that the corresponding URIs will be shown. .UNINDENT .sp \fBExamples\fP .sp To verify the list of nodes that are registered with the server, enter: .sp .nf .ft C $ knife node list .ft P .fi .sp to return something similar to: .sp .nf .ft C i\-12345678 rs\-123456 .ft P .fi .SH RUN_LIST ADD .sp The \fBrun_list add\fP argument is used to add run list items (roles or recipes) to a node. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node run_list add NODE_NAME RUN_LIST_ITEM (options) .ft P .fi .sp \fBOptions\fP .sp This argument has the following options: .INDENT 0.0 .TP .B \fB\-a ITEM\fP, \fB\-\-after ITEM\fP Use this to add the run list item after the specified run list item. .UNINDENT .sp \fBExamples\fP .sp To add a role to a run list, enter: .sp .nf .ft C $ knife node run_list add node \(aqrole[ROLE_NAME]\(aq .ft P .fi .sp To add roles and recipes to a run list, enter: .sp .nf .ft C $ knife node run_list add node \(aqrecipe[COOKBOOK::RECIPE_NAME],recipe[COOKBOOK::RECIPE_NAME],role[ROLE_NAME]\(aq .ft P .fi .sp To add a recipe to a run list using the fully qualified format, enter: .sp .nf .ft C $ knife node run_list add node \(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq .ft P .fi .sp To add a recipe to a run list using the cookbook format, enter: .sp .nf .ft C $ knife node run_list add node \(aqCOOKBOOK::RECIPE_NAME\(aq .ft P .fi .sp To add the default recipe of a cookbook to a run list, enter: .sp .nf .ft C $ knife node run_list add node \(aqCOOKBOOK\(aq .ft P .fi .SH RUN_LIST REMOVE .sp The \fBrun_list remove\fP argument is used to remove run list items (roles or recipes) from a node. A recipe must be in one of the following formats: fully qualified, cookbook, or default. Both roles and recipes must be in quotes, for example: \fB\(aqrole[ROLE_NAME]\(aq\fP or \fB\(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq\fP. Use a comma to separate roles and recipes when removing more than one, like this: \fB\(aqrecipe[COOKBOOK::RECIPE_NAME],COOKBOOK::RECIPE_NAME,role[ROLE_NAME]\(aq\fP. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node run_list remove NODE_NAME RUN_LIST_ITEM .ft P .fi .sp \fBOptions\fP .sp This command does not have any specific options. .sp \fBExamples\fP .sp To remove a role from a run list, enter: .sp .nf .ft C $ knife node run_list remove node \(aqrole[ROLE_NAME]\(aq .ft P .fi .sp To remove a recipe from a run list using the fully qualified format, enter: .sp .nf .ft C $ knife node run_list remove node \(aqrecipe[COOKBOOK::RECIPE_NAME]\(aq .ft P .fi .SH SHOW .sp The \fBshow\fP argument is used to display information about a node. .sp \fBSyntax\fP .sp This argument has the following syntax: .sp .nf .ft C $ knife node show NODE_NAME (options) .ft P .fi .sp \fBOptions\fP .sp This argument has the following options: .INDENT 0.0 .TP .B \fB\-a ATTR\fP, \fB\-\-attribute ATTR\fP The attribute (or attributes) to show. .TP .B \fB\-l\fP, \fB\-\-long\fP Display long output when searching nodes while using the default summary format. .TP .B \fB\-m\fP, \fB\-\-medium\fP Display more, but not all, of a node\(aqs data when searching using the default summary format. .TP .B \fB\-r\fP, \fB\-\-run\-list\fP Indicates that only the run\-list will be shown. .UNINDENT .sp \fBExamples\fP .sp To view all data for a node named "build", enter: .sp .nf .ft C $ knife node show build .ft P .fi .sp to return: .sp .nf .ft C Node Name: build Environment: _default FQDN: IP: Run List: Roles: Recipes: Platform: .ft P .fi .sp To show basic information about a node, truncated and nicely formatted: .sp .nf .ft C knife node show .ft P .fi .sp To show all information about a node, nicely formatted: .sp .nf .ft C knife node show \-l .ft P .fi .sp To list a single node attribute: .sp .nf .ft C knife node show \-a .ft P .fi .sp where \fB\fP is something like kernel or platform. (This doesn\(aqt work for nested attributes like \fBnode[kernel][machine]\fP because \fBknife node show\fP doesn\(aqt understand nested attributes.) .sp To view the FQDN for a node named "i\-12345678", enter: .sp .nf .ft C $ knife node show i\-12345678 \-a fqdn .ft P .fi .sp to return: .sp .nf .ft C fqdn: ip\-10\-251\-75\-20.ec2.internal .ft P .fi .sp To view the run list for a node named "dev", enter: .sp .nf .ft C $ knife node show dev \-r .ft P .fi .sp To view information in JSON format, use the \fB\-F\fP common option as part of the command like this: .sp .nf .ft C $ knife role show devops \-F json .ft P .fi .sp Other formats available include \fBtext\fP, \fByaml\fP, and \fBpp\fP. .sp To view node information in raw JSON, use the \fB\-l\fP or \fB\-\-long\fP option: .sp .nf .ft C knife node show \-l \-F json .ft P .fi .sp and/or: .sp .nf .ft C knife node show \-l \-\-format=json .ft P .fi .SH AUTHOR Chef .\" Generated by docutils manpage writer. .