website: document {{.Vars}} in execute_command example [GH-241]
This commit is contained in:
parent
46e49b745e
commit
46ec8f758b
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue