2013-06-18 19:51:46 -04:00
|
|
|
---
|
2017-06-14 21:04:16 -04:00
|
|
|
description: |
|
|
|
|
The digitalocean Packer builder is able to create new images for use with
|
2018-10-26 20:02:51 -04:00
|
|
|
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.
|
2015-07-22 22:31:00 -04:00
|
|
|
layout: docs
|
2017-06-14 21:04:16 -04:00
|
|
|
page_title: 'DigitalOcean - Builders'
|
|
|
|
sidebar_current: 'docs-builders-digitalocean'
|
2017-03-25 18:13:52 -04:00
|
|
|
---
|
|
|
|
|
2013-06-18 19:51:46 -04:00
|
|
|
# DigitalOcean Builder
|
|
|
|
|
|
|
|
Type: `digitalocean`
|
|
|
|
|
2014-10-20 16:47:30 -04:00
|
|
|
The `digitalocean` Packer builder is able to create new images for use with
|
2016-01-14 15:31:19 -05:00
|
|
|
[DigitalOcean](https://www.digitalocean.com). The builder takes a source image,
|
2015-07-22 22:31:00 -04:00
|
|
|
runs any provisioning necessary on the image after launching it, then snapshots
|
2018-10-26 20:02:51 -04:00
|
|
|
it into a reusable image. This reusable image can then be used as the
|
|
|
|
foundation of new servers that are launched within DigitalOcean.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
The builder does *not* manage images. Once it creates an image, it is up to you
|
|
|
|
to use it or delete it.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
|
|
|
## 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.
|
|
|
|
|
2015-06-23 17:44:57 -04:00
|
|
|
In addition to the options listed here, a
|
2015-07-22 22:31:00 -04:00
|
|
|
[communicator](/docs/templates/communicator.html) can be configured for this
|
|
|
|
builder.
|
2015-06-23 17:44:57 -04:00
|
|
|
|
2015-06-10 17:16:40 -04:00
|
|
|
### Required:
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `api_token` (string) - The client TOKEN to use to access your account. It
|
2018-10-26 20:02:51 -04:00
|
|
|
can also be specified via environment variable `DIGITALOCEAN_API_TOKEN`, if
|
|
|
|
set.
|
2014-09-15 07:43:10 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `image` (string) - The name (or slug) of the base image to use. This is the
|
2015-07-22 23:25:58 -04:00
|
|
|
image that will be used to launch a new droplet and provision it. See
|
2018-10-31 10:22:29 -04:00
|
|
|
<a href="https://developers.digitalocean.com/documentation/v2/#list-all-images" class="uri">https://developers.digitalocean.com/documentation/v2/#list-all-images</a>
|
|
|
|
for details on how to get a list of the accepted image names/slugs.
|
2014-04-29 23:33:31 -04:00
|
|
|
|
2018-10-26 20:02:51 -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.
|
|
|
|
See
|
2018-10-31 10:22:29 -04:00
|
|
|
<a href="https://developers.digitalocean.com/documentation/v2/#list-all-regions" class="uri">https://developers.digitalocean.com/documentation/v2/#list-all-regions</a>
|
2018-10-26 20:02:51 -04:00
|
|
|
for the accepted region names/slugs.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `size` (string) - The name (or slug) of the droplet size to use. See
|
2018-10-31 10:22:29 -04:00
|
|
|
<a href="https://developers.digitalocean.com/documentation/v2/#list-all-sizes" class="uri">https://developers.digitalocean.com/documentation/v2/#list-all-sizes</a>
|
|
|
|
for the accepted size names/slugs.
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2015-06-10 21:56:03 -04:00
|
|
|
### Optional:
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `api_url` (string) - Non standard api endpoint URL. Set this if you are
|
2016-02-05 07:57:43 -05:00
|
|
|
using a DigitalOcean API compatible service. It can also be specified via
|
|
|
|
environment variable `DIGITALOCEAN_API_URL`.
|
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `droplet_name` (string) - The name assigned to the droplet. DigitalOcean
|
2015-07-22 23:25:58 -04:00
|
|
|
sets the hostname of the machine to this value.
|
2015-06-10 21:56:03 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `private_networking` (boolean) - Set to `true` to enable private networking
|
2015-07-22 23:25:58 -04:00
|
|
|
for the droplet being created. This defaults to `false`, or not enabled.
|
2015-06-10 21:56:03 -04:00
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `monitoring` (boolean) - Set to `true` to enable monitoring for the droplet
|
|
|
|
being created. This defaults to `false`, or not enabled.
|
2017-04-09 11:25:54 -04:00
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `ipv6` (boolean) - Set to `true` to enable ipv6 for the droplet being
|
|
|
|
created. This defaults to `false`, or not enabled.
|
2017-11-01 14:43:08 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `snapshot_name` (string) - The name of the resulting snapshot that will
|
2018-06-03 10:37:38 -04:00
|
|
|
appear in your account. Defaults to "packer-{{timestamp}}" (see
|
|
|
|
[configuration templates](/docs/templates/engine.html) for more info).
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2018-10-26 20:02:51 -04:00
|
|
|
- `snapshot_regions` (array of strings) - The regions of the resulting
|
|
|
|
snapshot that will appear in your account.
|
2017-05-16 12:42:13 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `state_timeout` (string) - The time to wait, as a duration string, for a
|
2015-07-22 23:25:58 -04:00
|
|
|
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
|
|
|
|
2019-07-04 10:29:05 -04:00
|
|
|
- `snapshot_timeout` (string) - The time to wait, as a duration string, for a
|
|
|
|
snapshot action to complete (e.g snapshot creation) before timing out. The
|
|
|
|
default snapshot timeout is "60m".
|
|
|
|
|
2018-10-31 10:22:29 -04:00
|
|
|
- `user_data` (string) - User data to launch with the Droplet. Packer will
|
|
|
|
not automatically wait for a user script to finish before shutting down the
|
|
|
|
instance this must be handled in a provisioner.
|
2017-07-23 01:47:53 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
- `user_data_file` (string) - Path to a file that will be used for the user
|
2016-09-28 09:00:57 -04:00
|
|
|
data when launching the Droplet.
|
|
|
|
|
2018-07-30 13:27:57 -04:00
|
|
|
- `tags` (list) - Tags to apply to the droplet when it is created
|
|
|
|
|
2013-06-18 19:51:46 -04:00
|
|
|
## Basic Example
|
|
|
|
|
2015-07-22 22:31:00 -04:00
|
|
|
Here is a basic example. It is completely valid as soon as you enter your own
|
|
|
|
access tokens:
|
2013-06-18 19:51:46 -04:00
|
|
|
|
2017-06-14 21:04:16 -04:00
|
|
|
``` json
|
2013-06-18 19:51:46 -04:00
|
|
|
{
|
|
|
|
"type": "digitalocean",
|
2015-06-10 21:56:03 -04:00
|
|
|
"api_token": "YOUR API KEY",
|
2018-06-03 10:37:38 -04:00
|
|
|
"image": "ubuntu-16-04-x64",
|
2017-03-06 16:08:34 -05:00
|
|
|
"region": "nyc3",
|
|
|
|
"size": "512mb",
|
|
|
|
"ssh_username": "root"
|
2013-06-18 19:51:46 -04:00
|
|
|
}
|
2014-10-20 13:55:16 -04:00
|
|
|
```
|