From d43fa85e7baaa26c0e3ea54eaa358b1b90c07c36 Mon Sep 17 00:00:00 2001 From: Jamie Snell Date: Tue, 14 Jun 2016 17:18:08 -0500 Subject: [PATCH] update docs to reflect knife_command change --- .../docs/provisioners/chef-client.html.md | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/website/source/docs/provisioners/chef-client.html.md b/website/source/docs/provisioners/chef-client.html.md index 47b68ca7b..f26a4036b 100644 --- a/website/source/docs/provisioners/chef-client.html.md +++ b/website/source/docs/provisioners/chef-client.html.md @@ -71,6 +71,11 @@ configuration is actually required. - `json` (object) - An arbitrary mapping of JSON that will be available as node attributes while running Chef. +- `knife_command` (string) - The command used to run Knife during node clean-up. This has + various [configuration template + variables](/docs/templates/configuration-templates.html) available. See + below for more information. + - `node_name` (string) - The name of the node to register with the Chef Server. This is optional and by default is packer-{{uuid}}. @@ -194,7 +199,7 @@ This command can be customized using the `execute_command` configuration. As you can see from the default value above, the value of this configuration can contain various template variables, defined below: -- `ConfigPath` - The path to the Chef configuration file. file. +- `ConfigPath` - The path to the Chef configuration file. - `JsonPath` - The path to the JSON attributes file for the node. - `Sudo` - A boolean of whether to `sudo` the command or not, depending on the value of the `prevent_sudo` configuration. @@ -219,6 +224,37 @@ powershell.exe -Command "(New-Object System.Net.WebClient).DownloadFile('http:// This command can be customized using the `install_command` configuration. +## Knife Command + +By default, Packer uses the following command (broken across multiple lines for +readability) to execute Chef: + +``` {.liquid} +{{if .Sudo}}sudo {{end}}knife \ + {{.Args}} \ + {{.Flags}} +``` + +When guest_os_type is set to "windows", Packer uses the following command to +execute Chef. The full path to Chef is required because the PATH environment +variable changes don't immediately propogate to running processes. + +``` {.liquid} +c:/opscode/chef/bin/knife.bat \ + {{.Args}} \ + {{.Flags}} +``` + +This command can be customized using the `knife_command` configuration. As you +can see from the default value above, the value of this configuration can +contain various template variables, defined below: + +- `Args` - The command arguments that are getting passed to the Knife command. +- `Flags` - The command flags that are getting passed to the Knife command.. +- `Sudo` - A boolean of whether to `sudo` the command or not, depending on the + value of the `prevent_sudo` configuration. + + ## Folder Permissions !> The `chef-client` provisioner will chmod the directory with your Chef keys