2015-06-14 14:17:50 -04:00
|
|
|
---
|
2017-06-14 21:04:16 -04:00
|
|
|
description: |
|
|
|
|
The Windows restart provisioner restarts a Windows machine and waits for it to
|
|
|
|
come back up.
|
2015-08-03 14:32:54 -04:00
|
|
|
layout: docs
|
2017-06-14 21:04:16 -04:00
|
|
|
page_title: 'Windows Restart - Provisioners'
|
|
|
|
sidebar_current: 'docs-provisioners-windows-restart'
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
2015-06-14 14:17:50 -04:00
|
|
|
|
|
|
|
# Windows Restart Provisioner
|
|
|
|
|
|
|
|
Type: `windows-restart`
|
|
|
|
|
2015-08-03 14:32:54 -04:00
|
|
|
The Windows restart provisioner initiates a reboot on a Windows machine and
|
|
|
|
waits for the machine to come back online.
|
2015-06-14 14:17:50 -04:00
|
|
|
|
|
|
|
The Windows provisioning process often requires multiple reboots, and this
|
|
|
|
provisioner helps to ease that process.
|
|
|
|
|
2016-04-20 15:34:53 -04:00
|
|
|
Packer expects the machine to be ready to continue provisioning after it
|
|
|
|
reboots. Packer detects that the reboot has completed by making an RPC call
|
|
|
|
through the Windows Remote Management (WinRM) service, not by ACPI functions, so Windows must be completely booted in order to continue.
|
|
|
|
|
2015-06-14 14:17:50 -04:00
|
|
|
## Basic Example
|
|
|
|
|
|
|
|
The example below is fully functional.
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
``` json
|
2015-06-14 14:17:50 -04:00
|
|
|
{
|
|
|
|
"type": "windows-restart"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Configuration Reference
|
|
|
|
|
|
|
|
The reference of available configuration options is listed below.
|
|
|
|
|
|
|
|
Optional parameters:
|
|
|
|
|
2016-04-20 15:34:53 -04:00
|
|
|
- `restart_command` (string) - The command to execute to initiate the
|
2017-03-12 05:48:08 -04:00
|
|
|
restart. By default this is `shutdown /r /f /t 0 /c "packer restart"`.
|
2015-06-14 14:17:50 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `restart_check_command` (string) - A command to execute to check if the
|
2017-11-07 19:00:40 -05:00
|
|
|
restart succeeded. This will be done in a loop. Example usage:
|
2015-06-14 14:17:50 -04:00
|
|
|
|
2017-11-07 19:00:40 -05:00
|
|
|
``` json
|
|
|
|
{
|
|
|
|
"type": "windows-restart",
|
|
|
|
"restart_check_command": "powershell -command \"& {Write-Output 'restarted.'}\""
|
|
|
|
},
|
|
|
|
```
|
2015-06-14 14:17:50 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `restart_timeout` (string) - The timeout to wait for the restart. By
|
2016-04-20 15:34:53 -04:00
|
|
|
default this is 5 minutes. Example value: `5m`. If you are installing
|
|
|
|
updates or have a lot of startup services, you will probably need to
|
|
|
|
increase this duration.
|