packer-cn/website/source/docs/provisioners/shell-local.html.md

53 lines
1.6 KiB
Markdown
Raw Normal View History

2015-06-19 18:31:17 -04:00
---
2017-06-14 21:04:16 -04:00
description: |
2017-11-27 20:26:03 -05:00
shell-local will run a shell script of your choosing on the machine where Packer
is being run - in other words, it shell-local will run the shell script on your
build server, or your desktop, etc., rather than the remote/guest machine being
2017-11-27 18:15:52 -05:00
provisioned by Packer.
2015-08-03 14:32:54 -04:00
layout: docs
2017-06-14 21:04:16 -04:00
page_title: 'Shell (Local) - Provisioners'
sidebar_current: 'docs-provisioners-shell-local'
---
2015-06-19 18:31:17 -04:00
# Local Shell Provisioner
Type: `shell-local`
2017-11-27 20:26:03 -05:00
shell-local will run a shell script of your choosing on the machine where Packer
is being run - in other words, it shell-local will run the shell script on your
build server, or your desktop, etc., rather than the remote/guest machine being
2017-11-27 18:15:52 -05:00
provisioned by Packer.
The [remote shell](/docs/provisioners/shell.html) provisioner executes
2015-08-03 14:32:54 -04:00
shell scripts on a remote machine.
2015-06-19 18:31:17 -04:00
## Basic Example
The example below is fully functional.
2017-06-14 21:04:16 -04:00
``` json
2015-06-19 18:31:17 -04:00
{
"type": "shell-local",
"command": "echo foo"
}
```
## Configuration Reference
The reference of available configuration options is listed below. The only
required element is "command".
Required:
2017-06-14 21:04:16 -04:00
- `command` (string) - The command to execute. This will be executed within
2015-08-03 14:32:54 -04:00
the context of a shell as specified by `execute_command`.
2015-06-19 18:31:17 -04:00
Optional parameters:
2017-06-14 21:04:16 -04:00
- `execute_command` (array of strings) - The command to use to execute
the script. By default this is `["/bin/sh", "-c", "{{.Command}}"]`. The value
2015-08-03 14:32:54 -04:00
is an array of arguments executed directly by the OS. The value of this is
treated as [configuration
2017-03-28 18:28:34 -04:00
template](/docs/templates/engine.html). The only available
2015-08-03 14:32:54 -04:00
variable is `Command` which is the command to execute.