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
72c1a438
Commit
72c1a438
authored
Jun 10, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
website: document config templates
parent
3ee0e2a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletion
+52
-1
website/source/docs/builders/amazon-ebs.html.markdown
website/source/docs/builders/amazon-ebs.html.markdown
+2
-1
website/source/docs/templates/configuration-templates.html.markdown
...urce/docs/templates/configuration-templates.html.markdown
+49
-0
website/source/layouts/docs.erb
website/source/layouts/docs.erb
+1
-0
No files found.
website/source/docs/builders/amazon-ebs.html.markdown
View file @
72c1a438
...
@@ -82,7 +82,8 @@ Here is a basic example. It is completely valid except for the access keys:
...
@@ -82,7 +82,8 @@ Here is a basic example. It is completely valid except for the access keys:
## AMI Name Variables
## AMI Name Variables
The AMI name specified by the
`ami_name`
configuration variable is actually
The AMI name specified by the
`ami_name`
configuration variable is actually
treated as a template. Packer provides a set of variables that it will replace
treated as a
[
configuration template
](
/docs/templates/configuration-templates.html
)
.
Packer provides a set of variables that it will replace
within the AMI name. This helps ensure the AMI name is unique, as AWS requires.
within the AMI name. This helps ensure the AMI name is unique, as AWS requires.
The available variables are shown below:
The available variables are shown below:
...
...
website/source/docs/templates/configuration-templates.html.markdown
0 → 100644
View file @
72c1a438
---
layout
:
"
docs"
---
# Configuration Templates
Certain configuration parameters within templates are themselves a
type of "template." These are not Packer templates, but text templates,
where variables can be used to modify the value of a configuration parameter
during runtime.
For example, the
`ami_name`
configuration for the
[
AMI builder
](
/docs/builders/amazon-ebs.html
)
is a template. An example value may be
`My Packer AMI {{.CreateTime}}`
. At
runtime, this will be turned into
`My Packer AMI 1370900368`
, where the
"CreateTime" variable was replaced with the Unix timestamp of when the
AMI was actually created.
This sort of templating is pervasive throughout Packer. Instead of documenting
the templating syntax in each location, it is documented once here so
you know how to use it.
<div
class=
"alert alert-info"
>
<strong>
For advanced users:
</strong>
The templates are actually parsed and executed
using Go's
<a
href=
"http://golang.org/pkg/text/template/"
>
text/template
</a>
package. It therefore supports the complete template syntax.
</div>
## Syntax
99% of the time all you'll need within configuration templates are variables.
Variables are accessed by using
`{{.VARIABLENAME}}`
. The "." prefixing the
variable name signals that you're accessing a variable on the root
template object. All template directives go between braces. Here is a piece
of a VMware VMX template that uses variables:
<pre>
.encoding = "UTF-8"
displayName = "{{ .Name }}"
guestOS = "{{ .GuestOS }}"
</pre>
In this case, the "Name" and "GuestOS" variables will be replaced, potentially
resulting in a VMX that looks like this:
<pre>
.encoding = "UTF-8"
displayName = "packer"
guestOS = "otherlinux"
</pre>
website/source/layouts/docs.erb
View file @
72c1a438
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
<li><a
href=
"/docs/templates/introduction.html"
>
Introduction
</a></li>
<li><a
href=
"/docs/templates/introduction.html"
>
Introduction
</a></li>
<li><a
href=
"/docs/templates/builders.html"
>
Builders
</a></li>
<li><a
href=
"/docs/templates/builders.html"
>
Builders
</a></li>
<li><a
href=
"/docs/templates/provisioners.html"
>
Provisioners
</a></li>
<li><a
href=
"/docs/templates/provisioners.html"
>
Provisioners
</a></li>
<li><a
href=
"/docs/templates/configuration-templates.html"
>
Configuration Templates
</a></li>
<li
class=
"nav-header"
>
Builders
</li>
<li
class=
"nav-header"
>
Builders
</li>
<li><a
href=
"/docs/builders/amazon-ebs.html"
>
EC2 (AMI)
</a></li>
<li><a
href=
"/docs/builders/amazon-ebs.html"
>
EC2 (AMI)
</a></li>
...
...
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