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
31357df1
Commit
31357df1
authored
Jun 29, 2015
by
Chris Bednarski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2359 from mitchellh/d-execute-command
Document shell provisioner example for FreeBSD
parents
caa518b2
6c2e6c41
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
website/source/docs/provisioners/shell.html.markdown
website/source/docs/provisioners/shell.html.markdown
+18
-4
No files found.
website/source/docs/provisioners/shell.html.markdown
View file @
31357df1
...
...
@@ -89,10 +89,14 @@ Optional parameters:
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**
.
most common use case for this is dealing with
**sudo password prompts**
. You may
also need to customize this if you use a non-POSIX shell, such as
`tcsh`
on
FreeBSD.
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
### Sudo Example
Some operating systems default to a non-root user. For example if you login
as
`ubuntu`
and can sudo using the password
`packer`
, then you'll want to
change
`execute_command`
to be:
```
text
...
...
@@ -100,13 +104,23 @@ change `execute_command` to be:
```
The
`-S`
flag tells
`sudo`
to read the password from stdin, which in this
case is being piped in with the value of
"packer"
. The
`-E`
flag tells
`sudo`
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.
### FreeBSD Example
FreeBSD's default shell is
`tcsh`
, which deviates from POSIX sematics. In order
for packer to pass environment variables you will need to change the
`execute_command`
to:
chmod +x {{ .Path }}; env {{ .Vars }} {{ .Path }}
Note the addition of
`env`
before
`{{ .Vars }}`
.
## Default Environmental Variables
In addition to being able to specify custom environmental variables using
...
...
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