The shell Packer provisioner provisions machines built by Packer using shell
description:|-
scripts. Shell provisioning is the easiest way to get software installed and
The shell Packer provisioner provisions machines built by Packer using shell scripts. Shell provisioning is the easiest way to get software installed and configured on a machine.
configured on a machine.
---
layout: docs
page_title: Local Shell Provisioner
...
# Local Shell Provisioner
# Local Shell Provisioner
Type: `shell-local`
Type: `shell-local`
The local shell provisioner executes a local shell script on the machine
The local shell provisioner executes a local shell script on the machine running
running Packer. The [remote shell](/docs/provisioners/shell.html)
Packer. The [remote shell](/docs/provisioners/shell.html) provisioner executes
provisioner executes shell scripts on a remote machine.
shell scripts on a remote machine.
## Basic Example
## Basic Example
The example below is fully functional.
The example below is fully functional.
```javascript
``` {.javascript}
{
{
"type": "shell-local",
"type": "shell-local",
"command": "echo foo"
"command": "echo foo"
...
@@ -31,15 +33,14 @@ required element is "command".
...
@@ -31,15 +33,14 @@ required element is "command".
Required:
Required:
*`command` (string) - The command to execute. This will be executed
-`command` (string) - The command to execute. This will be executed within
within the context of a shell as specified by `execute_command`.
the context of a shell as specified by `execute_command`.
Optional parameters:
Optional parameters:
*`execute_command` (array of strings) - The command to use to execute the script.
-`execute_command` (array of strings) - The command to use to execute
By default this is `["/bin/sh", "-c", "{{.Command}"]`. The value is an array
the script. By default this is `["/bin/sh", "-c", "{{.Command}"]`. The value
of arguments executed directly by the OS.
is an array of arguments executed directly by the OS. The value of this is
The value of this is
treated as [configuration
treated as [configuration template](/docs/templates/configuration-templates.html).
template](/docs/templates/configuration-templates.html). The only available
The only available variable is `Command` which is the command to execute.
variable is `Command` which is the command to execute.