Commit 8a3ee293 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

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

parent 2b41f058
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment