2013-06-18 19:51:46 -04:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
---
|
|
|
|
|
|
|
|
# DigitalOcean Builder
|
|
|
|
|
|
|
|
Type: `digitalocean`
|
|
|
|
|
|
|
|
The `digitalocean` builder is able to create new images for use with
|
|
|
|
[DigitalOcean](http://www.digitalocean.com). 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.
|
|
|
|
|
|
|
|
The builder does _not_ manage images. Once it creates an image, it is up to
|
|
|
|
you to use it or delete it.
|
|
|
|
|
|
|
|
## Configuration Reference
|
|
|
|
|
|
|
|
There are many configuration options available for the builder. They are
|
|
|
|
segmented below into two categories: required and optional parameters. Within
|
|
|
|
each category, the available configuration keys are alphabetized.
|
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
### Required:
|
2013-06-18 19:51:46 -04:00
|
|
|
|
|
|
|
* `api_key` (string) - The API key to use to access your account. You can
|
|
|
|
retrieve this on the "API" page visible after logging into your account
|
2014-05-04 13:47:40 -04:00
|
|
|
on DigitalOcean.
|
|
|
|
If not specified, Packer will use the environment variable
|
|
|
|
`DIGITALOCEAN_API_KEY`, if set.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
|
|
|
* `client_id` (string) - The client ID to use to access your account. You can
|
|
|
|
find this on the "API" page visible after logging into your account on
|
2014-05-04 13:47:40 -04:00
|
|
|
DigitalOcean.
|
|
|
|
If not specified, Packer will use the environment variable
|
|
|
|
`DIGITALOCEAN_CLIENT_ID`, if set.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
### Optional:
|
|
|
|
|
|
|
|
* `droplet_name` (string) - The name assigned to the droplet. DigitalOcean
|
|
|
|
sets the hostname of the machine to this value.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2014-04-29 23:33:31 -04:00
|
|
|
* `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. This
|
|
|
|
defaults to 'ubuntu-12-04-x64' which is the slug for "Ubuntu 12.04.4 x64".
|
2014-06-28 00:25:43 -04:00
|
|
|
See https://developers.digitalocean.com/#list-all-images for details on how to get a list of the the accepted image names/slugs.
|
2014-04-29 23:33:31 -04:00
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `image_id` (integer) - The ID of the base image to use. This is the image that
|
2014-04-29 23:33:31 -04:00
|
|
|
will be used to launch a new droplet and provision it.
|
|
|
|
This setting is deprecated. Use `image` instead.
|
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `private_networking` (boolean) - Set to `true` to enable private networking
|
|
|
|
for the droplet being created. This defaults to `false`, or not enabled.
|
|
|
|
|
2014-04-29 23:33:31 -04:00
|
|
|
* `region` (string) - The name (or slug) of the region to launch the droplet in.
|
|
|
|
Consequently, this is the region where the snapshot will be available.
|
2014-04-30 20:10:12 -04:00
|
|
|
This defaults to "nyc1", which is the slug for "New York 1".
|
2014-04-29 23:33:31 -04:00
|
|
|
See https://developers.digitalocean.com/regions/ for the accepted region names/slugs.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `region_id` (integer) - The ID of the region to launch the droplet in. Consequently,
|
2014-04-29 23:33:31 -04:00
|
|
|
this is the region where the snapshot will be available.
|
|
|
|
This setting is deprecated. Use `region` instead.
|
|
|
|
|
|
|
|
* `size` (string) - The name (or slug) of the droplet size to use.
|
|
|
|
This defaults to "512mb", which is the slug for "512MB".
|
|
|
|
See https://developers.digitalocean.com/sizes/ for the accepted size names/slugs.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `size_id` (integer) - The ID of the droplet size to use.
|
2014-04-29 23:33:31 -04:00
|
|
|
This setting is deprecated. Use `size` instead.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
|
|
|
* `snapshot_name` (string) - The name of the resulting snapshot that will
|
2013-08-08 20:01:33 -04:00
|
|
|
appear in your account. This must be unique.
|
|
|
|
To help make this unique, use a function like `timestamp` (see
|
|
|
|
[configuration templates](/docs/templates/configuration-templates.html) for more info)
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `ssh_port` (integer) - The port that SSH will be available on. Defaults to port
|
2013-06-18 19:51:46 -04:00
|
|
|
22.
|
|
|
|
|
|
|
|
* `ssh_timeout` (string) - The time to wait for SSH to become available
|
|
|
|
before timing out. The format of this value is a duration such as "5s"
|
|
|
|
or "5m". The default SSH timeout is "1m".
|
|
|
|
|
|
|
|
* `ssh_username` (string) - The username to use in order to communicate
|
|
|
|
over SSH to the running droplet. Default is "root".
|
|
|
|
|
2013-06-23 06:57:05 -04:00
|
|
|
* `state_timeout` (string) - The time to wait, as a duration string,
|
2014-05-04 13:47:40 -04:00
|
|
|
for a droplet to enter a desired state (such as "active") before
|
|
|
|
timing out. The default state timeout is "6m".
|
2013-06-23 06:57:05 -04:00
|
|
|
|
2013-06-18 19:51:46 -04:00
|
|
|
## Basic Example
|
|
|
|
|
|
|
|
Here is a basic example. It is completely valid as soon as you enter your
|
|
|
|
own access tokens:
|
|
|
|
|
|
|
|
<pre class="prettyprint">
|
|
|
|
{
|
|
|
|
"type": "digitalocean",
|
|
|
|
"client_id": "YOUR CLIENT ID",
|
|
|
|
"api_key": "YOUR API KEY"
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
|
2013-06-18 22:25:54 -04:00
|
|
|
## Finding Image, Region, and Size IDs
|
|
|
|
|
|
|
|
Unfortunately, finding a list of available values for `image_id`, `region_id`,
|
|
|
|
and `size_id` is not easy at the moment. Basically, it has to be done through
|
|
|
|
the [DigitalOcean API](https://www.digitalocean.com/api_access) using the
|
|
|
|
`/images`, `/regions`, and `/sizes` endpoints. You can use `curl` for this
|
|
|
|
or request it in your browser.
|
|
|
|
|
|
|
|
If you're comfortable installing RubyGems, [Tugboat](https://github.com/pearkes/tugboat)
|
|
|
|
is a fantastic DigitalOcean command-line client that has commands to
|
|
|
|
find the available images, regions, and sizes. For example, to see all the
|
|
|
|
global images, you can run `tugboat images --global`.
|