website: document {{.Vars}} in execute_command example [GH-241]

This commit is contained in:
Mitchell Hashimoto 2013-08-03 13:40:31 -07:00
parent 2b41f05848
commit 8a3ee293af
1 changed files with 4 additions and 2 deletions

View File

@ -78,11 +78,13 @@ and has the password "packer" for sudo usage, then you'll likely want to
change `execute_command` to be:
```
"echo 'packer' | sudo -S sh '{{ .Path }}'"
"echo 'packer' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
```
The `-S` flag tells `sudo` to read the password from stdin, which in this
case is being piped in with the value of "packer".
case is being piped in with the value of "packer". The `-E` flag tells `sudo`
to preserve the environment, allowing our environmental variables to work
within the script.
By setting the `execute_command` to this, your script(s) can run with
root privileges without worrying about password prompts.