packer-cn/website/source/docs/extend/plugins.html.markdown

69 lines
3.1 KiB
Markdown
Raw Normal View History

2013-06-10 20:17:31 -04:00
---
layout: "docs"
2013-08-18 12:42:19 -04:00
page_title: "Packer Plugins - Extend Packer"
description: |-
Packer Plugins allow new functionality to be added to Packer without modifying the core source code. Packer plugins are able to add new commands, builders, provisioners, hooks, and more. In fact, much of Packer itself is implemented by writing plugins that are simply distributed with Packer. For example, all the commands, builders, provisioners, and more that ship with Packer are implemented as Plugins that are simply hardcoded to load with Packer.
2013-06-10 20:17:31 -04:00
---
# Packer Plugins
Packer Plugins allow new functionality to be added to Packer without
2013-06-10 20:17:31 -04:00
modifying the core source code. Packer plugins are able to add new
commands, builders, provisioners, hooks, and more. In fact, much of Packer
itself is implemented by writing plugins that are simply distributed with
Packer. For example, all the commands, builders, provisioners, and more
2013-06-10 20:17:31 -04:00
that ship with Packer are implemented as Plugins that are simply hardcoded
to load with Packer.
This page will cover how to install and use plugins. If you're interested
in developing plugins, the documentation for that is available the
2013-06-11 00:47:16 -04:00
[developing plugins](/docs/extend/developing-plugins.html) page.
2013-06-10 20:17:31 -04:00
Because Packer is so young, there is no official listing of available
Packer plugins. Plugins are best found via Google. Typically, searching
"packer plugin _x_" will find what you're looking for if it exists. As
Packer gets older, an official plugin directory is planned.
## How Plugins Work
Packer plugins are completely separate, standalone applications that the
core of Packer starts and communicates with.
These plugin applications aren't meant to be run manually. Instead, Packer core executes
these plugin applications in a certain way and communicates with them.
For example, the VMware builder is actually a standalone binary named
`packer-builder-vmware`. The next time you run a Packer build, look at
your process list and you should see a handful of `packer-` prefixed
applications running.
## Installing Plugins
The easiest way to install a plugin is to name it correctly, then place
it in the proper directory. To name a plugin correctly, make sure the
binary is named `packer-TYPE-NAME`. For example, `packer-builder-amazon-ebs`
for a "builder" type plugin named "amazon-ebs". Valid types for plugins
are down this page more.
Once the plugin is named properly, Packer automatically discovers plugins
in the following directories in the given order. If a conflicting plugin is
found later, it will take precedence over one found earlier.
1. The directory where `packer` is, or the executable directory.
2. `~/.packer.d/plugins` on Unix systems or `%APPDATA%/packer.d/plugins` on
Windows.
3. The current working directory.
The valid types for plugins are:
* `builder` - Plugins responsible for building images for a specific platform.
* `command` - A CLI sub-command for `packer`.
* `post-processor` - A post-processor responsible for taking an artifact
from a builder and turning it into something else.
* `provisioner` - A provisioner to install software on images created by
a builder.