Add Windows to Chef provisioner documentation
This commit is contained in:
parent
8014dac742
commit
7195b2f35b
|
@ -50,11 +50,19 @@ configuration is actually required.
|
|||
should use a custom configuration template. See the dedicated "Chef
|
||||
Configuration" section below for more details.
|
||||
|
||||
- `encrypted_data_bag_secret_path` (string) - The path to the file containing
|
||||
the secret for encrypted data bags. By default, this is empty, so no
|
||||
secret will be available.
|
||||
|
||||
- `execute_command` (string) - The command used to execute Chef. This has
|
||||
various [configuration template
|
||||
variables](/docs/templates/configuration-templates.html) available. See
|
||||
below for more information.
|
||||
|
||||
- `guest_os_type` (string) - The target guest OS type, either "unix" or
|
||||
"windows". Setting this to "windows" will cause the provisioner to use
|
||||
Windows friendly paths and commands. By default, this is "unix".
|
||||
|
||||
- `install_command` (string) - The command used to install Chef. This has
|
||||
various [configuration template
|
||||
variables](/docs/templates/configuration-templates.html) available. See
|
||||
|
@ -68,7 +76,8 @@ configuration is actually required.
|
|||
|
||||
- `prevent_sudo` (boolean) - By default, the configured commands that are
|
||||
executed to install and run Chef are executed with `sudo`. If this is true,
|
||||
then the sudo will be omitted.
|
||||
then the sudo will be omitted. This has no effect when guest_os_type is
|
||||
windows.
|
||||
|
||||
- `run_list` (array of strings) - The [run
|
||||
list](http://docs.chef.io/essentials_node_object_run_lists.html)
|
||||
|
@ -87,11 +96,12 @@ configuration is actually required.
|
|||
on the machine using the Chef omnibus installers.
|
||||
|
||||
- `staging_directory` (string) - This is the directory where all the
|
||||
configuration of Chef by Packer will be placed. By default this
|
||||
is "/tmp/packer-chef-client". This directory doesn't need to exist but must
|
||||
have proper permissions so that the SSH user that Packer uses is able to
|
||||
create directories and write into this folder. If the permissions are not
|
||||
correct, use a shell provisioner prior to this to configure it properly.
|
||||
configuration of Chef by Packer will be placed. By default this is
|
||||
"/tmp/packer-chef-client" when guest_os_type unix and
|
||||
"$env:TEMP/packer-chef-client" when windows. This directory doesn't need to
|
||||
exist but must have proper permissions so that the user that Packer uses is
|
||||
able to create directories and write into this folder. By default the
|
||||
provisioner will create and chmod 0777 this directory.
|
||||
|
||||
- `client_key` (string) - Path to client key. If not set, this defaults to a
|
||||
file named client.pem in `staging_directory`.
|
||||
|
@ -119,6 +129,10 @@ The default value for the configuration template is:
|
|||
log_level :info
|
||||
log_location STDOUT
|
||||
chef_server_url "{{.ServerUrl}}"
|
||||
client_key "{{.ClientKey}}"
|
||||
{{if ne .EncryptedDataBagSecretPath ""}}
|
||||
encrypted_data_bag_secret "{{.EncryptedDataBagSecretPath}}"
|
||||
{{end}}
|
||||
{{if ne .ValidationClientName ""}}
|
||||
validation_client_name "{{.ValidationClientName}}"
|
||||
{{else}}
|
||||
|
@ -127,8 +141,12 @@ validation_client_name "chef-validator"
|
|||
{{if ne .ValidationKeyPath ""}}
|
||||
validation_key "{{.ValidationKeyPath}}"
|
||||
{{end}}
|
||||
{{if ne .NodeName ""}}
|
||||
node_name "{{.NodeName}}"
|
||||
{{if ne .ChefEnvironment ""}}
|
||||
environment "{{.ChefEnvironment}}"
|
||||
{{end}}
|
||||
{{if ne .SslVerifyMode ""}}
|
||||
ssl_verify_mode :{{.SslVerifyMode}}
|
||||
{{end}}
|
||||
```
|
||||
|
||||
|
@ -136,8 +154,13 @@ This template is a [configuration
|
|||
template](/docs/templates/configuration-templates.html) and has a set of
|
||||
variables available to use:
|
||||
|
||||
- `ChefEnvironment` - The Chef environment name.
|
||||
- `EncryptedDataBagSecretPath` - The path to the secret key file to decrypt
|
||||
encrypted data bags.
|
||||
- `NodeName` - The node name set in the configuration.
|
||||
- `ServerUrl` - The URL of the Chef Server set in the configuration.
|
||||
- `SslVerifyMode` - Whether Chef SSL verify mode is on or off.
|
||||
- `ValidationClientName` - The name of the client used for validation.
|
||||
- `ValidationKeyPath` - Path to the validation key, if it is set.
|
||||
|
||||
## Execute Command
|
||||
|
@ -152,6 +175,17 @@ readability) to execute Chef:
|
|||
-j {{.JsonPath}}
|
||||
```
|
||||
|
||||
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/chef-client.bat \
|
||||
--no-color \
|
||||
-c {{.ConfigPath}} \
|
||||
-j {{.JsonPath}}
|
||||
```
|
||||
|
||||
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:
|
||||
|
@ -172,6 +206,13 @@ curl -L https://www.chef.io/chef/install.sh | \
|
|||
{{if .Sudo}}sudo{{end}} bash
|
||||
```
|
||||
|
||||
When guest_os_type is set to "windows", Packer uses the following command to
|
||||
install the latest version of Chef:
|
||||
|
||||
``` {.text}
|
||||
powershell.exe -Command "(New-Object System.Net.WebClient).DownloadFile('http://chef.io/chef/install.msi', 'C:\\Windows\\Temp\\chef.msi');Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait"
|
||||
```
|
||||
|
||||
This command can be customized using the `install_command` configuration.
|
||||
|
||||
## Folder Permissions
|
||||
|
|
|
@ -68,6 +68,10 @@ configuration is actually required, but at least `run_list` is recommended.
|
|||
variables](/docs/templates/configuration-templates.html) available. See
|
||||
below for more information.
|
||||
|
||||
- `guest_os_type` (string) - The target guest OS type, either "unix" or
|
||||
"windows". Setting this to "windows" will cause the provisioner to use
|
||||
Windows friendly paths and commands. By default, this is "unix".
|
||||
|
||||
- `install_command` (string) - The command used to install Chef. This has
|
||||
various [configuration template
|
||||
variables](/docs/templates/configuration-templates.html) available. See
|
||||
|
@ -78,7 +82,8 @@ configuration is actually required, but at least `run_list` is recommended.
|
|||
|
||||
- `prevent_sudo` (boolean) - By default, the configured commands that are
|
||||
executed to install and run Chef are executed with `sudo`. If this is true,
|
||||
then the sudo will be omitted.
|
||||
then the sudo will be omitted. This has no effect when guest_os_type is
|
||||
windows.
|
||||
|
||||
- `remote_cookbook_paths` (array of strings) - A list of paths on the remote
|
||||
machine where cookbooks will already exist. These may exist from a previous
|
||||
|
@ -97,11 +102,13 @@ configuration is actually required, but at least `run_list` is recommended.
|
|||
on the machine using the Chef omnibus installers.
|
||||
|
||||
- `staging_directory` (string) - This is the directory where all the
|
||||
configuration of Chef by Packer will be placed. By default this
|
||||
is "/tmp/packer-chef-solo". This directory doesn't need to exist but must
|
||||
have proper permissions so that the SSH user that Packer uses is able to
|
||||
create directories and write into this folder. If the permissions are not
|
||||
correct, use a shell provisioner prior to this to configure it properly.
|
||||
configuration of Chef by Packer will be placed. By default this is
|
||||
"/tmp/packer-chef-solo" when guest_os_type unix and
|
||||
"$env:TEMP/packer-chef-solo" when windows. This directory doesn't need to
|
||||
exist but must have proper permissions so that the user that Packer uses is
|
||||
able to create directories and write into this folder. If the permissions
|
||||
are not correct, use a shell provisioner prior to this to configure it
|
||||
properly.
|
||||
|
||||
## Chef Configuration
|
||||
|
||||
|
@ -141,6 +148,17 @@ readability) to execute Chef:
|
|||
-j {{.JsonPath}}
|
||||
```
|
||||
|
||||
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/chef-solo.bat \
|
||||
--no-color \
|
||||
-c {{.ConfigPath}} \
|
||||
-j {{.JsonPath}}
|
||||
```
|
||||
|
||||
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:
|
||||
|
@ -161,4 +179,11 @@ curl -L https://www.chef.io/chef/install.sh | \
|
|||
{{if .Sudo}}sudo{{end}} bash
|
||||
```
|
||||
|
||||
When guest_os_type is set to "windows", Packer uses the following command to
|
||||
install the latest version of Chef:
|
||||
|
||||
``` {.text}
|
||||
powershell.exe -Command "(New-Object System.Net.WebClient).DownloadFile('http://chef.io/chef/install.msi', 'C:\\Windows\\Temp\\chef.msi');Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait"
|
||||
```
|
||||
|
||||
This command can be customized using the `install_command` configuration.
|
||||
|
|
Loading…
Reference in New Issue