Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
330e3405
Commit
330e3405
authored
Jun 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
website: execute_command example
parent
1585f3fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
website/source/docs/provisioners/shell.html.markdown
website/source/docs/provisioners/shell.html.markdown
+20
-0
No files found.
website/source/docs/provisioners/shell.html.markdown
View file @
330e3405
...
@@ -55,3 +55,23 @@ Optional parameters:
...
@@ -55,3 +55,23 @@ Optional parameters:
*
`remote_path`
(string) - The path where the script will be uploaded to
*
`remote_path`
(string) - The path where the script will be uploaded to
in the machine. This defaults to "/tmp/script.sh". This value must be
in the machine. This defaults to "/tmp/script.sh". This value must be
a writable location and any parent directories must already exist.
a writable location and any parent directories must already exist.
## Execute Command Example
To many new users, the
`execute_command`
is puzzling. However, it provides
an important function: customization of how the command is executed. The
most common use case for this is dealing with
**sudo password prompts**
.
For example, if the default user of an installed operating system is "packer"
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 }}'"
```
The
`-S`
flag tells
`sudo`
to read the password from stdin, which in this
case is being piped in with the value of "packer".
By setting the
`execute_command`
to this, your script(s) can run with
root privileges without worrying about password prompts.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment