Commit c656a01b authored by Chris Bednarski's avatar Chris Bednarski

Merge pull request #2490 from mitchellh/docs-revamp

Reformat docs using htmlbeautifier and pandoc
parents 40f2173c e0be4efe
...@@ -3,3 +3,5 @@ source "https://rubygems.org" ...@@ -3,3 +3,5 @@ source "https://rubygems.org"
ruby "2.2.2" ruby "2.2.2"
gem "middleman-hashicorp", github: "hashicorp/middleman-hashicorp" gem "middleman-hashicorp", github: "hashicorp/middleman-hashicorp"
gem "middleman-breadcrumbs"
gem "htmlbeautifier"
\ No newline at end of file
...@@ -69,6 +69,7 @@ GEM ...@@ -69,6 +69,7 @@ GEM
hitimes (1.2.2) hitimes (1.2.2)
hooks (0.4.0) hooks (0.4.0)
uber (~> 0.0.4) uber (~> 0.0.4)
htmlbeautifier (1.1.0)
htmlcompressor (0.2.0) htmlcompressor (0.2.0)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (0.7.0) i18n (0.7.0)
...@@ -92,6 +93,8 @@ GEM ...@@ -92,6 +93,8 @@ GEM
middleman-sprockets (>= 3.1.2) middleman-sprockets (>= 3.1.2)
sass (>= 3.4.0, < 4.0) sass (>= 3.4.0, < 4.0)
uglifier (~> 2.5) uglifier (~> 2.5)
middleman-breadcrumbs (0.1.0)
middleman (>= 3.3.5)
middleman-core (3.3.12) middleman-core (3.3.12)
activesupport (~> 4.1.0) activesupport (~> 4.1.0)
bundler (~> 1.1) bundler (~> 1.1)
...@@ -179,4 +182,6 @@ PLATFORMS ...@@ -179,4 +182,6 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
htmlbeautifier
middleman-breadcrumbs
middleman-hashicorp! middleman-hashicorp!
...@@ -8,3 +8,10 @@ dev: init ...@@ -8,3 +8,10 @@ dev: init
build: init build: init
PACKER_DISABLE_DOWNLOAD_FETCH=true PACKER_VERSION=1.0 bundle exec middleman build PACKER_DISABLE_DOWNLOAD_FETCH=true PACKER_VERSION=1.0 bundle exec middleman build
format:
bundle exec htmlbeautifier -t 2 source/*.erb
bundle exec htmlbeautifier -t 2 source/layouts/*.erb
@pandoc -v > /dev/null || echo "pandoc must be installed in order to format markdown content"
pandoc -v > /dev/null && find . -iname "*.html.markdown" | xargs -I{} bash -c "pandoc -r markdown -w markdown --tab-stop=4 --atx-headers -s --columns=80 {} > {}.new"\; || true
pandoc -v > /dev/null && find . -iname "*.html.markdown" | xargs -I{} bash -c "mv {}.new {}"\; || true
...@@ -21,3 +21,13 @@ make dev ...@@ -21,3 +21,13 @@ make dev
Then open up `localhost:4567`. Note that some URLs you may need to append Then open up `localhost:4567`. Note that some URLs you may need to append
".html" to make them work (in the navigation and such). ".html" to make them work (in the navigation and such).
## Keeping Tidy
To keep the source code nicely formatted, there is a `make format` target. This
runs `htmlbeautify` and `pandoc` to reformat the source code so it's nicely formatted.
make format
Note that you will need to install pandoc yourself. `make format` will skip it
if you don't have it installed.
\ No newline at end of file
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
set :base_url, "https://www.packer.io/" set :base_url, "https://www.packer.io/"
activate :breadcrumbs
activate :hashicorp do |h| activate :hashicorp do |h|
h.version = ENV["PACKER_VERSION"] h.version = ENV["PACKER_VERSION"]
h.bintray_enabled = ENV["BINTRAY_ENABLED"] h.bintray_enabled = ENV["BINTRAY_ENABLED"]
......
--- ---
layout: "community" description: |
page_title: "Community" Packer is a new project with a growing community. Despite this, there are
description: |- dedicated users willing to help through various mediums.
Packer is a new project with a growing community. Despite this, there are dedicated users willing to help through various mediums. layout: community
--- page_title: Community
...
# Community # Community
Packer is a new project with a growing community. Despite this, there are Packer is a new project with a growing community. Despite this, there are
dedicated users willing to help through various mediums. dedicated users willing to help through various mediums.
**IRC:**&nbsp;`#packer-tool` on Freenode. **IRC:** `#packer-tool` on Freenode.
**Mailing List:**&nbsp;[Packer Google Group](http://groups.google.com/group/packer-tool) **Mailing List:** [Packer Google
Group](http://groups.google.com/group/packer-tool)
**Bug Tracker:**&nbsp;[Issue tracker on GitHub](https://github.com/mitchellh/packer/issues). **Bug Tracker:** [Issue tracker on
Please only use this for reporting bugs. Do not ask for general help here. Use IRC GitHub](https://github.com/mitchellh/packer/issues). Please only use this for
or the mailing list for that. reporting bugs. Do not ask for general help here. Use IRC or the mailing list
for that.
## People ## People
...@@ -25,7 +28,9 @@ to Packer in some core way. Over time, faces may appear and disappear from this ...@@ -25,7 +28,9 @@ to Packer in some core way. Over time, faces may appear and disappear from this
list as contributors come and go. list as contributors come and go.
<div class="people"> <div class="people">
<div class="person">
<div class="person">
<img class="pull-left" src="http://www.gravatar.com/avatar/54079122b67de9677c1f93933ce8b63a.png?s=125"> <img class="pull-left" src="http://www.gravatar.com/avatar/54079122b67de9677c1f93933ce8b63a.png?s=125">
<div class="bio"> <div class="bio">
<h3>Mitchell Hashimoto (<a href="https://github.com/mitchellh">@mitchellh</a>)</h3> <h3>Mitchell Hashimoto (<a href="https://github.com/mitchellh">@mitchellh</a>)</h3>
...@@ -37,9 +42,11 @@ list as contributors come and go. ...@@ -37,9 +42,11 @@ list as contributors come and go.
described as "automation obsessed." described as "automation obsessed."
</p> </p>
</div> </div>
</div>
<div class="person"> </div>
<div class="person">
<img class="pull-left" src="http://www.gravatar.com/avatar/2acc31dd6370a54b18f6755cd0710ce6.png?s=125"> <img class="pull-left" src="http://www.gravatar.com/avatar/2acc31dd6370a54b18f6755cd0710ce6.png?s=125">
<div class="bio"> <div class="bio">
<h3>Jack Pearkes (<a href="https://github.com/pearkes">@pearkes</a>)</h3> <h3>Jack Pearkes (<a href="https://github.com/pearkes">@pearkes</a>)</h3>
...@@ -48,9 +55,11 @@ list as contributors come and go. ...@@ -48,9 +55,11 @@ list as contributors come and go.
for Packer. Outside of Packer, Jack is an avid open source for Packer. Outside of Packer, Jack is an avid open source
contributor and software consultant.</p> contributor and software consultant.</p>
</div> </div>
</div>
<div class="person"> </div>
<div class="person">
<img class="pull-left" src="http://www.gravatar.com/avatar/2f7fc9cb7558e3ea48f5a86fa90a78da.png?s=125"> <img class="pull-left" src="http://www.gravatar.com/avatar/2f7fc9cb7558e3ea48f5a86fa90a78da.png?s=125">
<div class="bio"> <div class="bio">
<h3>Mark Peek (<a href="https://github.com/markpeek">@markpeek</a>)</h3> <h3>Mark Peek (<a href="https://github.com/markpeek">@markpeek</a>)</h3>
...@@ -61,26 +70,40 @@ list as contributors come and go. ...@@ -61,26 +70,40 @@ list as contributors come and go.
<a href="https://github.com/ironport">IronPort Python libraries</a>. <a href="https://github.com/ironport">IronPort Python libraries</a>.
Mark is also a <a href="https://FreeBSD.org">FreeBSD committer</a>.</p> Mark is also a <a href="https://FreeBSD.org">FreeBSD committer</a>.</p>
</div> </div>
</div>
<div class="person"> </div>
<div class="person">
<img class="pull-left" src="http://www.gravatar.com/avatar/1fca64df3d7db1e2f258a8956d2b0aff.png?s=125"> <img class="pull-left" src="http://www.gravatar.com/avatar/1fca64df3d7db1e2f258a8956d2b0aff.png?s=125">
<div class="bio"> <div class="bio">
<h3>Ross Smith II (<a href="https://github.com/rasa" target="_blank">@rasa</a>)</h3> <h3>Ross Smith II (<a href="https://github.com/rasa" target="_blank">@rasa</a>)</h3>
<p> <p>
<a href="http://smithii.com/" target="_blank">Ross Smith</a> maintains our VMware builder on Windows, and provides other valuable assistance.
Ross is an open source enthusiast, published author, and freelance consultant.</p> <a href="http://smithii.com/" target="_blank">Ross Smith</a> maintains our
</div> VMware builder on Windows, and provides other valuable assistance. Ross is an
open source enthusiast, published author, and freelance consultant.
</p>
</div> </div>
<div class="person"> </div>
<div class="person">
<img class="pull-left" src="http://www.gravatar.com/avatar/c9f6bf7b5b865012be5eded656ebed7d.png?s=125"> <img class="pull-left" src="http://www.gravatar.com/avatar/c9f6bf7b5b865012be5eded656ebed7d.png?s=125">
<div class="bio"> <div class="bio">
<h3>Rickard von Essen<br/>(<a href="https://github.com/rickard-von-essen" target="_blank">@rickard-von-essen</a>)</h3> <h3>Rickard von Essen<br/>(<a href="https://github.com/rickard-von-essen" target="_blank">@rickard-von-essen</a>)</h3>
<p> <p>
Rickard von Essen maintains our Parallels Desktop builder. Rickard is an polyglot programmer and consults on Continuous Delivery.</p>
</div> Rickard von Essen maintains our Parallels Desktop builder. Rickard is an
polyglot programmer and consults on Continuous Delivery.
</p>
</div> </div>
<div class="clearfix"></div> </div>
<div class="clearfix">
</div>
</div> </div>
--- ---
layout: "docs" description: |
page_title: "Packer Terminology" There are a handful of terms used throughout the Packer documentation where the
description: |- meaning may not be immediately obvious if you haven't used Packer before.
There are a handful of terms used throughout the Packer documentation where the meaning may not be immediately obvious if you haven't used Packer before. Luckily, there are relatively few. This page documents all the terminology required to understand and use Packer. The terminology is in alphabetical order for easy referencing. Luckily, there are relatively few. This page documents all the terminology
--- required to understand and use Packer. The terminology is in alphabetical order
for easy referencing.
layout: docs
page_title: Packer Terminology
...
# Packer Terminology # Packer Terminology
There are a handful of terms used throughout the Packer documentation where There are a handful of terms used throughout the Packer documentation where the
the meaning may not be immediately obvious if you haven't used Packer before. meaning may not be immediately obvious if you haven't used Packer before.
Luckily, there are relatively few. This page documents all the terminology Luckily, there are relatively few. This page documents all the terminology
required to understand and use Packer. The terminology is in alphabetical required to understand and use Packer. The terminology is in alphabetical order
order for easy referencing. for easy referencing.
- `Artifacts` are the results of a single build, and are usually a set of IDs - `Artifacts` are the results of a single build, and are usually a set of IDs
or files to represent a machine image. Every builder produces a single or files to represent a machine image. Every builder produces a
artifact. As an example, in the case of the Amazon EC2 builder, the artifact is single artifact. As an example, in the case of the Amazon EC2 builder, the
a set of AMI IDs (one per region). For the VMware builder, the artifact is a artifact is a set of AMI IDs (one per region). For the VMware builder, the
directory of files comprising the created virtual machine. artifact is a directory of files comprising the created virtual machine.
- `Builds` are a single task that eventually produces an image for a single - `Builds` are a single task that eventually produces an image for a
platform. Multiple builds run in parallel. Example usage in a single platform. Multiple builds run in parallel. Example usage in a
sentence: "The Packer build produced an AMI to run our web application." sentence: "The Packer build produced an AMI to run our web application." Or:
Or: "Packer is running the builds now for VMware, AWS, and VirtualBox." "Packer is running the builds now for VMware, AWS, and VirtualBox."
- `Builders` are components of Packer that are able to create a machine - `Builders` are components of Packer that are able to create a machine image
image for a single platform. Builders read in some configuration and use for a single platform. Builders read in some configuration and use that to
that to run and generate a machine image. A builder is invoked as part of a run and generate a machine image. A builder is invoked as part of a build in
build in order to create the actual resulting images. Example builders include order to create the actual resulting images. Example builders include
VirtualBox, VMware, and Amazon EC2. Builders can be created and added to VirtualBox, VMware, and Amazon EC2. Builders can be created and added to
Packer in the form of plugins. Packer in the form of plugins.
- `Commands` are sub-commands for the `packer` program that perform some - `Commands` are sub-commands for the `packer` program that perform some job.
job. An example command is "build", which is invoked as `packer build`. An example command is "build", which is invoked as `packer build`. Packer
Packer ships with a set of commands out of the box in order to define ships with a set of commands out of the box in order to define its
its command-line interface. Commands can also be created and added to command-line interface. Commands can also be created and added to Packer in
Packer in the form of plugins. the form of plugins.
- `Post-processors` are components of Packer that take the result of - `Post-processors` are components of Packer that take the result of a builder
a builder or another post-processor and process that to or another post-processor and process that to create a new artifact.
create a new artifact. Examples of post-processors are Examples of post-processors are compress to compress artifacts, upload to
compress to compress artifacts, upload to upload artifacts, etc. upload artifacts, etc.
- `Provisioners` are components of Packer that install and configure - `Provisioners` are components of Packer that install and configure software
software within a running machine prior to that machine being turned within a running machine prior to that machine being turned into a
into a static image. They perform the major work of making the image contain static image. They perform the major work of making the image contain
useful software. Example provisioners include shell scripts, Chef, Puppet, useful software. Example provisioners include shell scripts, Chef,
etc. Puppet, etc.
- `Templates` are JSON files which define one or more builds - `Templates` are JSON files which define one or more builds by configuring
by configuring the various components of Packer. Packer is able to read a the various components of Packer. Packer is able to read a template and use
template and use that information to create multiple machine images in that information to create multiple machine images in parallel.
parallel.
--- ---
layout: "docs" description: |
page_title: "Amazon AMI Builder" Packer is able to create Amazon AMIs. To achieve this, Packer comes with
description: |- multiple builders depending on the strategy you want to use to build the AMI.
Packer is able to create Amazon AMIs. To achieve this, Packer comes with multiple builders depending on the strategy you want to use to build the AMI. layout: docs
--- page_title: Amazon AMI Builder
...
# Amazon AMI Builder # Amazon AMI Builder
Packer is able to create Amazon AMIs. To achieve this, Packer comes with Packer is able to create Amazon AMIs. To achieve this, Packer comes with
multiple builders depending on the strategy you want to use to build the multiple builders depending on the strategy you want to use to build the AMI.
AMI. Packer supports the following builders at the moment: Packer supports the following builders at the moment:
* [amazon-ebs](/docs/builders/amazon-ebs.html) - Create EBS-backed AMIs - [amazon-ebs](/docs/builders/amazon-ebs.html) - Create EBS-backed AMIs by
by launching a source AMI and re-packaging it into a new AMI after launching a source AMI and re-packaging it into a new AMI
provisioning. If in doubt, use this builder, which is the easiest to get after provisioning. If in doubt, use this builder, which is the easiest to
started with. get started with.
* [amazon-instance](/docs/builders/amazon-instance.html) - Create - [amazon-instance](/docs/builders/amazon-instance.html) - Create
instance-store AMIs by launching and provisioning a source instance, then instance-store AMIs by launching and provisioning a source instance, then
rebundling it and uploading it to S3. rebundling it and uploading it to S3.
* [amazon-chroot](/docs/builders/amazon-chroot.html) - Create EBS-backed AMIs - [amazon-chroot](/docs/builders/amazon-chroot.html) - Create EBS-backed AMIs
from an existing EC2 instance by mounting the root device and using a from an existing EC2 instance by mounting the root device and using a
[Chroot](http://en.wikipedia.org/wiki/Chroot) environment to provision [Chroot](http://en.wikipedia.org/wiki/Chroot) environment to provision
that device. This is an **advanced builder and should not be used by that device. This is an **advanced builder and should not be used by
newcomers**. However, it is also the fastest way to build an EBS-backed newcomers**. However, it is also the fastest way to build an EBS-backed AMI
AMI since no new EC2 instance needs to be launched. since no new EC2 instance needs to be launched.
-&gt; **Don't know which builder to use?** If in doubt, use the [amazon-ebs
builder](/docs/builders/amazon-ebs.html). It is much easier to use and Amazon
generally recommends EBS-backed images nowadays.
-> **Don't know which builder to use?** If in doubt, use the <span id="specifying-amazon-credentials"></span>
[amazon-ebs builder](/docs/builders/amazon-ebs.html). It is
much easier to use and Amazon generally recommends EBS-backed images nowadays.
<div id="specifying-amazon-credentials">## Specifying Amazon Credentials</div> ## Specifying Amazon Credentials
When you use any of the amazon builders, you must provide credentials to the API in the form of an access key id and secret. These look like: When you use any of the amazon builders, you must provide credentials to the API
in the form of an access key id and secret. These look like:
access key id: AKIAIOSFODNN7EXAMPLE access key id: AKIAIOSFODNN7EXAMPLE
secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
If you use other AWS tools you may already have these configured. If so, packer will try to use them, *unless* they are specified in your packer template. Credentials are resolved in the following order: If you use other AWS tools you may already have these configured. If so, packer
will try to use them, *unless* they are specified in your packer template.
Credentials are resolved in the following order:
1. Values hard-coded in the packer template are always authoritative. 1. Values hard-coded in the packer template are always authoritative.
2. *Variables* in the packer template may be resolved from command-line flags or from environment variables. Please read about [User Variables](https://packer.io/docs/templates/user-variables.html) for details. 2. *Variables* in the packer template may be resolved from command-line flags
or from environment variables. Please read about [User
Variables](https://packer.io/docs/templates/user-variables.html)
for details.
3. If no credentials are found, packer falls back to automatic lookup. 3. If no credentials are found, packer falls back to automatic lookup.
### Automatic Lookup ### Automatic Lookup
If no AWS credentials are found in a packer template, we proceed on to the following steps: If no AWS credentials are found in a packer template, we proceed on to the
following steps:
1. Lookup via environment variables. 1. Lookup via environment variables.
- First `AWS_ACCESS_KEY_ID`, then `AWS_ACCESS_KEY` - First `AWS_ACCESS_KEY_ID`, then `AWS_ACCESS_KEY`
- First `AWS_SECRET_ACCESS_KEY`, then `AWS_SECRET_KEY` - First `AWS_SECRET_ACCESS_KEY`, then `AWS_SECRET_KEY`
2. Look for [local AWS configuration files](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
2. Look for [local AWS configuration
files](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
- First `~/.aws/credentials` - First `~/.aws/credentials`
- Next based on `AWS_PROFILE` - Next based on `AWS_PROFILE`
3. Lookup an IAM role for the current EC2 instance (if you're running in EC2) 3. Lookup an IAM role for the current EC2 instance (if you're running in EC2)
~> **Subtle details of automatic lookup may change over time.** The most reliable way to specify your configuration is by setting them in template variables (directly or indirectly), or by using the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. \~&gt; **Subtle details of automatic lookup may change over time.** The most
reliable way to specify your configuration is by setting them in template
variables (directly or indirectly), or by using the `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` environment variables.
Environment variables provide the best portability, allowing you to run your packer build on your workstation, in Atlas, or on another build server. Environment variables provide the best portability, allowing you to run your
packer build on your workstation, in Atlas, or on another build server.
## Using an IAM Instance Profile ## Using an IAM Instance Profile
If AWS keys are not specified in the template, Packer will consult the [credentials](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files) file, try the standard AWS environment variables, and then If AWS keys are not specified in the template, a
any IAM role credentials defined by the instance's metadata. [credentials](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-config-files)
file or through environment variables Packer will use credentials provided by
the instance's IAM profile, if it has one.
The following policy document provides the minimal set permissions necessary for Packer to work: The following policy document provides the minimal set permissions necessary for
Packer to work:
```javascript ``` {.javascript}
{ {
"Statement": [{ "Statement": [{
"Effect": "Allow", "Effect": "Allow",
...@@ -104,13 +124,18 @@ The following policy document provides the minimal set permissions necessary for ...@@ -104,13 +124,18 @@ The following policy document provides the minimal set permissions necessary for
### Attaching IAM Policies to Roles ### Attaching IAM Policies to Roles
IAM policies can be associated with user or roles. If you use packer with IAM roles, you may encounter an error like this one: IAM policies can be associated with user or roles. If you use packer with IAM
roles, you may encounter an error like this one:
==> amazon-ebs: Error launching source instance: You are not authorized to perform this operation. ==> amazon-ebs: Error launching source instance: You are not authorized to perform this operation.
You can read more about why this happens on the [Amazon Security Blog](http://blogs.aws.amazon.com/security/post/Tx3M0IFB5XBOCQX/Granting-Permission-to-Launch-EC2-Instances-with-IAM-Roles-PassRole-Permission). The example policy below may help packer work with IAM roles. Note that this example provides more than the minimal set of permissions needed for packer to work, but specifics will depend on your use-case. You can read more about why this happens on the [Amazon Security
Blog](http://blogs.aws.amazon.com/security/post/Tx3M0IFB5XBOCQX/Granting-Permission-to-Launch-EC2-Instances-with-IAM-Roles-PassRole-Permission).
The example policy below may help packer work with IAM roles. Note that this
example provides more than the minimal set of permissions needed for packer to
work, but specifics will depend on your use-case.
```json ``` {.json}
{ {
"Sid": "PackerIAMPassRole", "Sid": "PackerIAMPassRole",
"Effect": "Allow", "Effect": "Allow",
......
--- ---
layout: "docs" description: |
page_title: "Custom Builder" Packer is extensible, allowing you to write new builders without having to
description: |- modify the core source code of Packer itself. Documentation for creating new
Packer is extensible, allowing you to write new builders without having to modify the core source code of Packer itself. Documentation for creating new builders is covered in the custom builders page of the Packer plugin section. builders is covered in the custom builders page of the Packer plugin section.
--- layout: docs
page_title: Custom Builder
...
# Custom Builder # Custom Builder
Packer is extensible, allowing you to write new builders without having to Packer is extensible, allowing you to write new builders without having to
modify the core source code of Packer itself. Documentation for creating modify the core source code of Packer itself. Documentation for creating new
new builders is covered in the [custom builders](/docs/extend/builder.html) builders is covered in the [custom builders](/docs/extend/builder.html) page of
page of the Packer plugin section. the Packer plugin section.
--- ---
layout: "docs" description: |
page_title: "DigitalOcean Builder" The `digitalocean` Packer builder is able to create new images for use with
description: |- DigitalOcean. The builder takes a source image, runs any provisioning necessary
The `digitalocean` Packer builder is able to create new images for use with DigitalOcean. The builder takes a source image, runs any provisioning necessary on the image after launching it, then snapshots it into a reusable image. This reusable image can then be used as the foundation of new servers that are launched within DigitalOcean. on the image after launching it, then snapshots it into a reusable image. This
--- reusable image can then be used as the foundation of new servers that are
launched within DigitalOcean.
layout: docs
page_title: DigitalOcean Builder
...
# DigitalOcean Builder # DigitalOcean Builder
Type: `digitalocean` Type: `digitalocean`
The `digitalocean` Packer builder is able to create new images for use with The `digitalocean` Packer builder is able to create new images for use with
[DigitalOcean](http://www.digitalocean.com). The builder takes a source [DigitalOcean](http://www.digitalocean.com). The builder takes a source image,
image, runs any provisioning necessary on the image after launching it, runs any provisioning necessary on the image after launching it, then snapshots
then snapshots it into a reusable image. This reusable image can then be it into a reusable image. This reusable image can then be used as the foundation
used as the foundation of new servers that are launched within DigitalOcean. of new servers that are launched within DigitalOcean.
The builder does _not_ manage images. Once it creates an image, it is up to The builder does *not* manage images. Once it creates an image, it is up to you
you to use it or delete it. to use it or delete it.
## Configuration Reference ## Configuration Reference
...@@ -25,50 +29,55 @@ segmented below into two categories: required and optional parameters. Within ...@@ -25,50 +29,55 @@ segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized. each category, the available configuration keys are alphabetized.
In addition to the options listed here, a In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) [communicator](/docs/templates/communicator.html) can be configured for this
can be configured for this builder. builder.
### Required: ### Required:
* `api_token` (string) - The client TOKEN to use to access your account. - `api_token` (string) - The client TOKEN to use to access your account. It
It can also be specified via environment variable `DIGITALOCEAN_API_TOKEN`, if set. can also be specified via environment variable `DIGITALOCEAN_API_TOKEN`,
if set.
* `image` (string) - The name (or slug) of the base image to use. This is the - `image` (string) - The name (or slug) of the base image to use. This is the
image that will be used to launch a new droplet and provision it. image that will be used to launch a new droplet and provision it. See
See https://developers.digitalocean.com/documentation/v2/#list-all-images for details on how to get a list of the the accepted image names/slugs. https://developers.digitalocean.com/documentation/v2/\#list-all-images for
details on how to get a list of the the accepted image names/slugs.
* `region` (string) - The name (or slug) of the region to launch the droplet in. - `region` (string) - The name (or slug) of the region to launch the
Consequently, this is the region where the snapshot will be available. droplet in. Consequently, this is the region where the snapshot will
See https://developers.digitalocean.com/documentation/v2/#list-all-regions for the accepted region names/slugs. be available. See
https://developers.digitalocean.com/documentation/v2/\#list-all-regions for
the accepted region names/slugs.
* `size` (string) - The name (or slug) of the droplet size to use. - `size` (string) - The name (or slug) of the droplet size to use. See
See https://developers.digitalocean.com/documentation/v2/#list-all-sizes for the accepted size names/slugs. https://developers.digitalocean.com/documentation/v2/\#list-all-sizes for
the accepted size names/slugs.
### Optional: ### Optional:
* `droplet_name` (string) - The name assigned to the droplet. DigitalOcean - `droplet_name` (string) - The name assigned to the droplet. DigitalOcean
sets the hostname of the machine to this value. sets the hostname of the machine to this value.
* `private_networking` (boolean) - Set to `true` to enable private networking - `private_networking` (boolean) - Set to `true` to enable private networking
for the droplet being created. This defaults to `false`, or not enabled. for the droplet being created. This defaults to `false`, or not enabled.
* `snapshot_name` (string) - The name of the resulting snapshot that will - `snapshot_name` (string) - The name of the resulting snapshot that will
appear in your account. This must be unique. appear in your account. This must be unique. To help make this unique, use a
To help make this unique, use a function like `timestamp` (see function like `timestamp` (see [configuration
[configuration templates](/docs/templates/configuration-templates.html) for more info) templates](/docs/templates/configuration-templates.html) for more info)
* `state_timeout` (string) - The time to wait, as a duration string, - `state_timeout` (string) - The time to wait, as a duration string, for a
for a droplet to enter a desired state (such as "active") before droplet to enter a desired state (such as "active") before timing out. The
timing out. The default state timeout is "6m". default state timeout is "6m".
* `user_data` (string) - User data to launch with the Droplet. - `user_data` (string) - User data to launch with the Droplet.
## Basic Example ## Basic Example
Here is a basic example. It is completely valid as soon as you enter your Here is a basic example. It is completely valid as soon as you enter your own
own access tokens: access tokens:
```javascript ``` {.javascript}
{ {
"type": "digitalocean", "type": "digitalocean",
"api_token": "YOUR API KEY", "api_token": "YOUR API KEY",
......
--- ---
layout: "docs" description: |
page_title: "Null Builder" The `null` Packer builder is not really a builder, it just sets up an SSH
description: |- connection and runs the provisioners. It can be used to debug provisioners
The `null` Packer builder is not really a builder, it just sets up an SSH connection and runs the provisioners. It can be used to debug provisioners without incurring high wait times. It does not create any kind of image or artifact. without incurring high wait times. It does not create any kind of image or
--- artifact.
layout: docs
page_title: Null Builder
...
# Null Builder # Null Builder
Type: `null` Type: `null`
The `null` Packer builder is not really a builder, it just sets up an SSH connection The `null` Packer builder is not really a builder, it just sets up an SSH
and runs the provisioners. It can be used to debug provisioners without connection and runs the provisioners. It can be used to debug provisioners
incurring high wait times. It does not create any kind of image or artifact. without incurring high wait times. It does not create any kind of image or
artifact.
## Basic Example ## Basic Example
Below is a fully functioning example. It doesn't do anything useful, since Below is a fully functioning example. It doesn't do anything useful, since no
no provisioners are defined, but it will connect to the specified host via ssh. provisioners are defined, but it will connect to the specified host via ssh.
```javascript ``` {.javascript}
{ {
"type": "null", "type": "null",
"ssh_host": "127.0.0.1", "ssh_host": "127.0.0.1",
...@@ -31,4 +35,3 @@ no provisioners are defined, but it will connect to the specified host via ssh. ...@@ -31,4 +35,3 @@ no provisioners are defined, but it will connect to the specified host via ssh.
The null builder has no configuration parameters other than the The null builder has no configuration parameters other than the
[communicator](/docs/templates/communicator.html) settings. [communicator](/docs/templates/communicator.html) settings.
--- ---
layout: "docs" description: |
page_title: "OpenStack Builder" The `openstack` Packer builder is able to create new images for use with
description: |- OpenStack. The builder takes a source image, runs any provisioning necessary on
The `openstack` Packer builder is able to create new images for use with OpenStack. The builder takes a source image, runs any provisioning necessary on the image after launching it, then creates a new reusable image. This reusable image can then be used as the foundation of new servers that are launched within OpenStack. The builder will create temporary keypairs that provide temporary access to the server while the image is being created. This simplifies configuration quite a bit. the image after launching it, then creates a new reusable image. This reusable
--- image can then be used as the foundation of new servers that are launched within
OpenStack. The builder will create temporary keypairs that provide temporary
access to the server while the image is being created. This simplifies
configuration quite a bit.
layout: docs
page_title: OpenStack Builder
...
# OpenStack Builder # OpenStack Builder
Type: `openstack` Type: `openstack`
The `openstack` Packer builder is able to create new images for use with The `openstack` Packer builder is able to create new images for use with
[OpenStack](http://www.openstack.org). The builder takes a source [OpenStack](http://www.openstack.org). The builder takes a source image, runs
image, runs any provisioning necessary on the image after launching it, any provisioning necessary on the image after launching it, then creates a new
then creates a new reusable image. This reusable image can then be reusable image. This reusable image can then be used as the foundation of new
used as the foundation of new servers that are launched within OpenStack. servers that are launched within OpenStack. The builder will create temporary
The builder will create temporary keypairs that provide temporary access to keypairs that provide temporary access to the server while the image is being
the server while the image is being created. This simplifies configuration created. This simplifies configuration quite a bit.
quite a bit.
The builder does _not_ manage images. Once it creates an image, it is up to The builder does *not* manage images. Once it creates an image, it is up to you
you to use it or delete it. to use it or delete it.
## Configuration Reference ## Configuration Reference
...@@ -28,81 +33,79 @@ segmented below into two categories: required and optional parameters. Within ...@@ -28,81 +33,79 @@ segmented below into two categories: required and optional parameters. Within
each category, the available configuration keys are alphabetized. each category, the available configuration keys are alphabetized.
In addition to the options listed here, a In addition to the options listed here, a
[communicator](/docs/templates/communicator.html) [communicator](/docs/templates/communicator.html) can be configured for this
can be configured for this builder. builder.
### Required: ### Required:
* `flavor` (string) - The ID, name, or full URL for the desired flavor for the - `flavor` (string) - The ID, name, or full URL for the desired flavor for the
server to be created. server to be created.
* `image_name` (string) - The name of the resulting image. - `image_name` (string) - The name of the resulting image.
* `source_image` (string) - The ID or full URL to the base image to use. - `source_image` (string) - The ID or full URL to the base image to use. This
This is the image that will be used to launch a new server and provision it. is the image that will be used to launch a new server and provision it.
Unless you specify completely custom SSH settings, the source image must Unless you specify completely custom SSH settings, the source image must
have `cloud-init` installed so that the keypair gets assigned properly. have `cloud-init` installed so that the keypair gets assigned properly.
* `username` (string) - The username used to connect to the OpenStack service. - `username` (string) - The username used to connect to the OpenStack service.
If not specified, Packer will use the environment variable If not specified, Packer will use the environment variable `OS_USERNAME`,
`OS_USERNAME`, if set. if set.
* `password` (string) - The password used to connect to the OpenStack service. - `password` (string) - The password used to connect to the OpenStack service.
If not specified, Packer will use the environment variables If not specified, Packer will use the environment variables `OS_PASSWORD`,
`OS_PASSWORD`, if set. if set.
### Optional: ### Optional:
* `api_key` (string) - The API key used to access OpenStack. Some OpenStack - `api_key` (string) - The API key used to access OpenStack. Some OpenStack
installations require this. installations require this.
* `availability_zone` (string) - The availability zone to launch the - `availability_zone` (string) - The availability zone to launch the
server in. If this isn't specified, the default enforced by your OpenStack server in. If this isn't specified, the default enforced by your OpenStack
cluster will be used. This may be required for some OpenStack clusters. cluster will be used. This may be required for some OpenStack clusters.
* `floating_ip` (string) - A specific floating IP to assign to this instance. - `floating_ip` (string) - A specific floating IP to assign to this instance.
`use_floating_ip` must also be set to true for this to have an affect. `use_floating_ip` must also be set to true for this to have an affect.
* `floating_ip_pool` (string) - The name of the floating IP pool to use - `floating_ip_pool` (string) - The name of the floating IP pool to use to
to allocate a floating IP. `use_floating_ip` must also be set to true allocate a floating IP. `use_floating_ip` must also be set to true for this
for this to have an affect. to have an affect.
* `insecure` (boolean) - Whether or not the connection to OpenStack can be done - `insecure` (boolean) - Whether or not the connection to OpenStack can be
over an insecure connection. By default this is false. done over an insecure connection. By default this is false.
* `networks` (array of strings) - A list of networks by UUID to attach - `networks` (array of strings) - A list of networks by UUID to attach to
to this instance. this instance.
* `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the - `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the
instance into. Some OpenStack installations require this. instance into. Some OpenStack installations require this. If not specified,
If not specified, Packer will use the environment variable Packer will use the environment variable `OS_TENANT_NAME`, if set.
`OS_TENANT_NAME`, if set.
* `security_groups` (array of strings) - A list of security groups by name - `security_groups` (array of strings) - A list of security groups by name to
to add to this instance. add to this instance.
* `region` (string) - The name of the region, such as "DFW", in which - `region` (string) - The name of the region, such as "DFW", in which to
to launch the server to create the AMI. launch the server to create the AMI. If not specified, Packer will use the
If not specified, Packer will use the environment variable environment variable `OS_REGION_NAME`, if set.
`OS_REGION_NAME`, if set.
* `ssh_interface` (string) - The type of interface to connect via SSH. Values - `ssh_interface` (string) - The type of interface to connect via SSH. Values
useful for Rackspace are "public" or "private", and the default behavior is useful for Rackspace are "public" or "private", and the default behavior is
to connect via whichever is returned first from the OpenStack API. to connect via whichever is returned first from the OpenStack API.
* `use_floating_ip` (boolean) - Whether or not to use a floating IP for - `use_floating_ip` (boolean) - Whether or not to use a floating IP for
the instance. Defaults to false. the instance. Defaults to false.
* `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for - `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
Rackconnect to assign the machine an IP address before connecting via SSH. Rackconnect to assign the machine an IP address before connecting via SSH.
Defaults to false. Defaults to false.
## Basic Example: Rackspace public cloud ## Basic Example: Rackspace public cloud
Here is a basic example. This is a working example to build a Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
Ubuntu 12.04 LTS (Precise Pangolin) on Rackspace OpenStack cloud offering. (Precise Pangolin) on Rackspace OpenStack cloud offering.
```javascript ``` {.javascript}
{ {
"type": "openstack", "type": "openstack",
"username": "foo", "username": "foo",
...@@ -117,10 +120,10 @@ Ubuntu 12.04 LTS (Precise Pangolin) on Rackspace OpenStack cloud offering. ...@@ -117,10 +120,10 @@ Ubuntu 12.04 LTS (Precise Pangolin) on Rackspace OpenStack cloud offering.
## Basic Example: Private OpenStack cloud ## Basic Example: Private OpenStack cloud
This example builds an Ubuntu 14.04 image on a private OpenStack cloud, This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered
powered by Metacloud. by Metacloud.
```javascript ``` {.javascript}
{ {
"type": "openstack", "type": "openstack",
"ssh_username": "root", "ssh_username": "root",
...@@ -130,12 +133,12 @@ powered by Metacloud. ...@@ -130,12 +133,12 @@ powered by Metacloud.
} }
``` ```
In this case, the connection information for connecting to OpenStack In this case, the connection information for connecting to OpenStack doesn't
doesn't appear in the template. That is because I source a standard appear in the template. That is because I source a standard OpenStack script
OpenStack script with environment variables set before I run this. This with environment variables set before I run this. This script is setting
script is setting environment variables like: environment variables like:
* `OS_AUTH_URL` - `OS_AUTH_URL`
* `OS_TENANT_ID` - `OS_TENANT_ID`
* `OS_USERNAME` - `OS_USERNAME`
* `OS_PASSWORD` - `OS_PASSWORD`
--- ---
layout: "docs" description: |
page_title: "Parallels Builder" The Parallels Packer builder is able to create Parallels Desktop for Mac virtual
description: |- machines and export them in the PVM format.
The Parallels Packer builder is able to create Parallels Desktop for Mac virtual machines and export them in the PVM format. layout: docs
--- page_title: Parallels Builder
...
# Parallels Builder # Parallels Builder
The Parallels Packer builder is able to create [Parallels Desktop for Mac](http://www.parallels.com/products/desktop/) virtual machines and export them in the PVM format. The Parallels Packer builder is able to create [Parallels Desktop for
Mac](http://www.parallels.com/products/desktop/) virtual machines and export
Packer actually comes with multiple builders able to create Parallels them in the PVM format.
machines, depending on the strategy you want to use to build the image.
Packer supports the following Parallels builders:
* [parallels-iso](/docs/builders/parallels-iso.html) - Starts from Packer actually comes with multiple builders able to create Parallels machines,
an ISO file, creates a brand new Parallels VM, installs an OS, depending on the strategy you want to use to build the image. Packer supports
provisions software within the OS, then exports that machine to create the following Parallels builders:
an image. This is best for people who want to start from scratch.
* [parallels-pvm](/docs/builders/parallels-pvm.html) - This builder - [parallels-iso](/docs/builders/parallels-iso.html) - Starts from an ISO
imports an existing PVM file, runs provisioners on top of that VM, file, creates a brand new Parallels VM, installs an OS, provisions software
and exports that machine to create an image. This is best if you have within the OS, then exports that machine to create an image. This is best
an existing Parallels VM export you want to use as the source. As an for people who want to start from scratch.
additional benefit, you can feed the artifact of this builder back into
itself to iterate on a machine.
- [parallels-pvm](/docs/builders/parallels-pvm.html) - This builder imports an
existing PVM file, runs provisioners on top of that VM, and exports that
machine to create an image. This is best if you have an existing Parallels
VM export you want to use as the source. As an additional benefit, you can
feed the artifact of this builder back into itself to iterate on a machine.
## Requirements ## Requirements
In addition to [Parallels Desktop for Mac](http://www.parallels.com/products/desktop/) this requires the In addition to [Parallels Desktop for
[Parallels Virtualization SDK](http://www.parallels.com/downloads/desktop/). Mac](http://www.parallels.com/products/desktop/) this requires the [Parallels
Virtualization SDK](http://www.parallels.com/downloads/desktop/).
The SDK can be installed by downloading and following the instructions in the dmg. The SDK can be installed by downloading and following the instructions in the
dmg.
--- ---
layout: "docs" description: |
page_title: "VirtualBox Builder" The VirtualBox Packer builder is able to create VirtualBox virtual machines and
description: |- export them in the OVA or OVF format.
The VirtualBox Packer builder is able to create VirtualBox virtual machines and export them in the OVA or OVF format. layout: docs
--- page_title: VirtualBox Builder
...
# VirtualBox Builder # VirtualBox Builder
The VirtualBox Packer builder is able to create [VirtualBox](http://www.virtualbox.org) The VirtualBox Packer builder is able to create
virtual machines and export them in the OVA or OVF format. [VirtualBox](http://www.virtualbox.org) virtual machines and export them in the
OVA or OVF format.
Packer actually comes with multiple builders able to create VirtualBox Packer actually comes with multiple builders able to create VirtualBox machines,
machines, depending on the strategy you want to use to build the image. depending on the strategy you want to use to build the image. Packer supports
Packer supports the following VirtualBox builders: the following VirtualBox builders:
* [virtualbox-iso](/docs/builders/virtualbox-iso.html) - Starts from - [virtualbox-iso](/docs/builders/virtualbox-iso.html) - Starts from an ISO
an ISO file, creates a brand new VirtualBox VM, installs an OS, file, creates a brand new VirtualBox VM, installs an OS, provisions software
provisions software within the OS, then exports that machine to create within the OS, then exports that machine to create an image. This is best
an image. This is best for people who want to start from scratch. for people who want to start from scratch.
* [virtualbox-ovf](/docs/builders/virtualbox-ovf.html) - This builder - [virtualbox-ovf](/docs/builders/virtualbox-ovf.html) - This builder imports
imports an existing OVF/OVA file, runs provisioners on top of that VM, an existing OVF/OVA file, runs provisioners on top of that VM, and exports
and exports that machine to create an image. This is best if you have that machine to create an image. This is best if you have an existing
an existing VirtualBox VM export you want to use as the source. As an VirtualBox VM export you want to use as the source. As an additional
additional benefit, you can feed the artifact of this builder back into benefit, you can feed the artifact of this builder back into itself to
itself to iterate on a machine. iterate on a machine.
--- ---
layout: "docs" description: |
page_title: "VMware Builder" The VMware Packer builder is able to create VMware virtual machines for use with
description: |- any VMware product.
The VMware Packer builder is able to create VMware virtual machines for use with any VMware product. layout: docs
--- page_title: VMware Builder
...
# VMware Builder # VMware Builder
The VMware Packer builder is able to create VMware virtual machines for use The VMware Packer builder is able to create VMware virtual machines for use with
with any VMware product. any VMware product.
Packer actually comes with multiple builders able to create VMware Packer actually comes with multiple builders able to create VMware machines,
machines, depending on the strategy you want to use to build the image. depending on the strategy you want to use to build the image. Packer supports
Packer supports the following VMware builders: the following VMware builders:
* [vmware-iso](/docs/builders/vmware-iso.html) - Starts from - [vmware-iso](/docs/builders/vmware-iso.html) - Starts from an ISO file,
an ISO file, creates a brand new VMware VM, installs an OS, creates a brand new VMware VM, installs an OS, provisions software within
provisions software within the OS, then exports that machine to create the OS, then exports that machine to create an image. This is best for
an image. This is best for people who want to start from scratch. people who want to start from scratch.
* [vmware-vmx](/docs/builders/vmware-vmx.html) - This builder - [vmware-vmx](/docs/builders/vmware-vmx.html) - This builder imports an
imports an existing VMware machine (from a VMX file), runs provisioners existing VMware machine (from a VMX file), runs provisioners on top of that
on top of that VM, and exports that machine to create an image. VM, and exports that machine to create an image. This is best if you have an
This is best if you have an existing VMware VM you want to use as the existing VMware VM you want to use as the source. As an additional benefit,
source. As an additional benefit, you can feed the artifact of this you can feed the artifact of this builder back into Packer to iterate on
builder back into Packer to iterate on a machine. a machine.
--- ---
layout: "docs" description: |
page_title: "Build - Command-Line" The `packer build` Packer command takes a template and runs all the builds
description: |- within it in order to generate a set of artifacts. The various builds specified
The `packer build` Packer command takes a template and runs all the builds within it in order to generate a set of artifacts. The various builds specified within a template are executed in parallel, unless otherwise specified. And the artifacts that are created will be outputted at the end of the build. within a template are executed in parallel, unless otherwise specified. And the
--- artifacts that are created will be outputted at the end of the build.
layout: docs
page_title: 'Build - Command-Line'
...
# Command-Line: Build # Command-Line: Build
The `packer build` Packer command takes a template and runs all the builds within The `packer build` Packer command takes a template and runs all the builds
it in order to generate a set of artifacts. The various builds specified within within it in order to generate a set of artifacts. The various builds specified
a template are executed in parallel, unless otherwise specified. And the within a template are executed in parallel, unless otherwise specified. And the
artifacts that are created will be outputted at the end of the build. artifacts that are created will be outputted at the end of the build.
## Options ## Options
* `-color=false` - Disables colorized output. Enabled by default. - `-color=false` - Disables colorized output. Enabled by default.
* `-debug` - Disables parallelization and enables debug mode. Debug mode flags - `-debug` - Disables parallelization and enables debug mode. Debug mode flags
the builders that they should output debugging information. The exact behavior the builders that they should output debugging information. The exact
of debug mode is left to the builder. In general, builders usually will stop behavior of debug mode is left to the builder. In general, builders usually
between each step, waiting for keyboard input before continuing. This will allow will stop between each step, waiting for keyboard input before continuing.
the user to inspect state and so on. This will allow the user to inspect state and so on.
* `-except=foo,bar,baz` - Builds all the builds except those with the given - `-except=foo,bar,baz` - Builds all the builds except those with the given
comma-separated names. Build names by default are the names of their builders, comma-separated names. Build names by default are the names of their
unless a specific `name` attribute is specified within the configuration. builders, unless a specific `name` attribute is specified within
the configuration.
* `-force` - Forces a builder to run when artifacts from a previous build prevent
a build from running. The exact behavior of a forced build is left to the builder. - `-force` - Forces a builder to run when artifacts from a previous build
In general, a builder supporting the forced build will remove the artifacts from prevent a build from running. The exact behavior of a forced build is left
the previous build. This will allow the user to repeat a build without having to to the builder. In general, a builder supporting the forced build will
manually clean these artifacts beforehand. remove the artifacts from the previous build. This will allow the user to
repeat a build without having to manually clean these artifacts beforehand.
* `-only=foo,bar,baz` - Only build the builds with the given comma-separated
names. Build names by default are the names of their builders, unless a - `-only=foo,bar,baz` - Only build the builds with the given
specific `name` attribute is specified within the configuration. comma-separated names. Build names by default are the names of their
builders, unless a specific `name` attribute is specified within
the configuration.
--- ---
layout: "docs" description: |
page_title: "Fix - Command-Line" The `packer fix` Packer command takes a template and finds backwards
description: |- incompatible parts of it and brings it up to date so it can be used with the
The `packer fix` Packer command takes a template and finds backwards incompatible parts of it and brings it up to date so it can be used with the latest version of Packer. After you update to a new Packer release, you should run the fix command to make sure your templates work with the new release. latest version of Packer. After you update to a new Packer release, you should
--- run the fix command to make sure your templates work with the new release.
layout: docs
page_title: 'Fix - Command-Line'
...
# Command-Line: Fix # Command-Line: Fix
The `packer fix` Packer command takes a template and finds backwards incompatible The `packer fix` Packer command takes a template and finds backwards
parts of it and brings it up to date so it can be used with the latest version incompatible parts of it and brings it up to date so it can be used with the
of Packer. After you update to a new Packer release, you should run the latest version of Packer. After you update to a new Packer release, you should
fix command to make sure your templates work with the new release. run the fix command to make sure your templates work with the new release.
The fix command will output the changed template to standard out, so you The fix command will output the changed template to standard out, so you should
should redirect standard using standard OS-specific techniques if you want to redirect standard using standard OS-specific techniques if you want to save it
save it to a file. For example, on Linux systems, you may want to do this: to a file. For example, on Linux systems, you may want to do this:
``` \$ packer fix old.json &gt; new.json
$ packer fix old.json > new.json
```
If fixing fails for any reason, the fix command will exit with a non-zero If fixing fails for any reason, the fix command will exit with a non-zero exit
exit status. Error messages appear on standard error, so if you're redirecting status. Error messages appear on standard error, so if you're redirecting
output, you'll still see error messages. output, you'll still see error messages.
-> **Even when Packer fix doesn't do anything** to the template, -&gt; **Even when Packer fix doesn't do anything** to the template, the template
the template will be outputted to standard out. Things such as configuration will be outputted to standard out. Things such as configuration key ordering and
key ordering and indentation may be changed. The output format however, is indentation may be changed. The output format however, is pretty-printed for
pretty-printed for human readability. human readability.
The full list of fixes that the fix command performs is visible in the The full list of fixes that the fix command performs is visible in the help
help output, which can be seen via `packer fix -h`. output, which can be seen via `packer fix -h`.
--- ---
layout: "docs" description: |
page_title: "Inspect - Command-Line" The `packer inspect` Packer command takes a template and outputs the various
description: |- components a template defines. This can help you quickly learn about a template
The `packer inspect` Packer command takes a template and outputs the various components a template defines. This can help you quickly learn about a template without having to dive into the JSON itself. The command will tell you things like what variables a template accepts, the builders it defines, the provisioners it defines and the order they'll run, and more. without having to dive into the JSON itself. The command will tell you things
--- like what variables a template accepts, the builders it defines, the
provisioners it defines and the order they'll run, and more.
layout: docs
page_title: 'Inspect - Command-Line'
...
# Command-Line: Inspect # Command-Line: Inspect
The `packer inspect` Packer command takes a template and outputs the various components The `packer inspect` Packer command takes a template and outputs the various
a template defines. This can help you quickly learn about a template without components a template defines. This can help you quickly learn about a template
having to dive into the JSON itself. without having to dive into the JSON itself. The command will tell you things
The command will tell you things like what variables a template accepts, like what variables a template accepts, the builders it defines, the
the builders it defines, the provisioners it defines and the order they'll provisioners it defines and the order they'll run, and more.
run, and more.
This command is extra useful when used with This command is extra useful when used with [machine-readable
[machine-readable output](/docs/command-line/machine-readable.html) enabled. output](/docs/command-line/machine-readable.html) enabled. The command outputs
The command outputs the components in a way that is parseable by machines. the components in a way that is parseable by machines.
The command doesn't validate the actual configuration of the various The command doesn't validate the actual configuration of the various components
components (that is what the `validate` command is for), but it will (that is what the `validate` command is for), but it will validate the syntax of
validate the syntax of your template by necessity. your template by necessity.
## Usage Example ## Usage Example
Given a basic template, here is an example of what the output might Given a basic template, here is an example of what the output might look like:
look like:
```text ``` {.text}
$ packer inspect template.json $ packer inspect template.json
Variables and their defaults: Variables and their defaults:
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<% wrap_layout :inner do %> <% wrap_layout :inner do %>
<% content_for :sidebar do %> <% content_for :sidebar do %>
<h2>Docs</h2> <h2>Docs</h2>
<ul> <ul>
<li><h4>Machine-Readable Reference</h4></li> <li>
<h4>Machine-Readable Reference</h4>
</li>
<li><a href="/docs/index.html">&laquo; Back to Docs</a></li> <li><a href="/docs/index.html">&laquo; Back to Docs</a></li>
<li><a href="/docs/machine-readable/general.html">General Types</a></li> <li><a href="/docs/machine-readable/general.html">General Types</a></li>
<li><a href="/docs/machine-readable/command-build.html">Command: build</a></li> <li><a href="/docs/machine-readable/command-build.html">Command: build</a></li>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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