From 46ec8f758b620ce055cfbeeb865dd3d3d66e1dc0 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 3 Aug 2013 13:40:31 -0700 Subject: [PATCH] website: document {{.Vars}} in execute_command example [GH-241] --- website/source/docs/provisioners/shell.html.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/source/docs/provisioners/shell.html.markdown b/website/source/docs/provisioners/shell.html.markdown index 35770f46b..702a0ecbb 100644 --- a/website/source/docs/provisioners/shell.html.markdown +++ b/website/source/docs/provisioners/shell.html.markdown @@ -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.