2013-08-27 01:02:03 -04:00
---
layout: "docs"
2014-08-21 20:41:35 -04:00
page_title: "OpenStack Builder"
2014-10-20 16:47:30 -04:00
description: |-
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.
2013-08-27 01:02:03 -04:00
---
# OpenStack Builder
Type: `openstack`
2014-10-20 16:47:30 -04:00
The `openstack` Packer builder is able to create new images for use with
2013-08-27 01:02:03 -04:00
[OpenStack ](http://www.openstack.org ). 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 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.
2015-06-23 17:44:57 -04:00
In addition to the options listed here, a
[communicator ](/docs/templates/communicator.html )
can be configured for this builder.
2014-05-04 13:47:40 -04:00
### Required:
2013-08-27 01:02:03 -04:00
2015-06-12 10:32:31 -04:00
* `flavor` (string) - The ID, name, or full URL for the desired flavor for the
2013-08-27 01:02:03 -04:00
server to be created.
* `image_name` (string) - The name of the resulting image.
* `source_image` (string) - The ID or full URL to the base image to use.
This is the image that will be used to launch a new server and provision it.
2015-06-12 11:14:28 -04:00
Unless you specify completely custom SSH settings, the source image must
have `cloud-init` installed so that the keypair gets assigned properly.
2013-08-27 01:02:03 -04:00
* `username` (string) - The username used to connect to the OpenStack service.
2015-06-12 00:33:52 -04:00
If not specified, Packer will use the environment variable
`OS_USERNAME` , if set.
* `password` (string) - The password used to connect to the OpenStack service.
2014-05-04 13:47:40 -04:00
If not specified, Packer will use the environment variables
2015-06-12 00:33:52 -04:00
`OS_PASSWORD` , if set.
2013-08-27 01:02:03 -04:00
2014-05-04 13:47:40 -04:00
### Optional:
2013-08-27 01:02:03 -04:00
2014-04-22 00:38:09 -04:00
* `api_key` (string) - The API key used to access OpenStack. Some OpenStack
2014-05-04 13:47:40 -04:00
installations require this.
2014-04-22 00:38:09 -04:00
2015-06-12 11:10:10 -04:00
* `availability_zone` (string) - The availability zone to launch the
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.
2014-04-30 19:55:50 -04:00
* `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.
* `floating_ip_pool` (string) - The name of the floating IP pool to use
to allocate a floating IP. `use_floating_ip` must also be set to true
for this to have an affect.
2014-05-05 12:44:25 -04:00
* `insecure` (boolean) - Whether or not the connection to OpenStack can be done
over an insecure connection. By default this is false.
2014-06-15 19:46:02 -04:00
* `networks` (array of strings) - A list of networks by UUID to attach
to this instance.
2015-06-12 00:33:52 -04:00
* `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the
instance into. Some OpenStack installations require this.
If not specified, Packer will use the environment variable
`OS_TENANT_NAME` , if set.
2014-10-20 13:55:16 -04:00
2014-05-01 23:26:07 -04:00
* `security_groups` (array of strings) - A list of security groups by name
to add to this instance.
2014-09-04 21:51:00 -04:00
* `region` (string) - The name of the region, such as "DFW", in which
to launch the server to create the AMI.
2015-06-12 00:33:52 -04:00
If not specified, Packer will use the environment variable
`OS_REGION_NAME` , if set.
2014-09-04 21:51:00 -04:00
2015-02-17 16:44:21 -05:00
* `ssh_interface` (string) - The type of interface to connect via SSH. Values
useful for Rackspace are "public" or "private", and the default behavior is
to connect via whichever is returned first from the OpenStack API.
2014-05-04 13:47:40 -04:00
* `use_floating_ip` (boolean) - Whether or not to use a floating IP for
the instance. Defaults to false.
2014-04-30 19:55:50 -04:00
2015-02-17 16:44:21 -05:00
* `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
Rackconnect to assign the machine an IP address before connecting via SSH.
Defaults to false.
2014-09-04 21:17:13 -04:00
## Basic Example: Rackspace public cloud
2013-08-27 01:02:03 -04:00
Here is a basic example. This is a working example to build a
Ubuntu 12.04 LTS (Precise Pangolin) on Rackspace OpenStack cloud offering.
2014-10-20 13:55:16 -04:00
```javascript
2013-08-27 01:02:03 -04:00
{
"type": "openstack",
2015-06-12 00:33:52 -04:00
"username": "foo",
"password": "foo",
2013-09-01 16:30:36 -04:00
"region": "DFW",
2013-08-27 01:02:03 -04:00
"ssh_username": "root",
"image_name": "Test image",
"source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
"flavor": "2"
}
2014-10-20 13:55:16 -04:00
```
2013-09-01 16:30:36 -04:00
2014-09-04 21:17:13 -04:00
## Basic Example: Private OpenStack cloud
This example builds an Ubuntu 14.04 image on a private OpenStack cloud,
powered by Metacloud.
2014-10-20 13:55:16 -04:00
```javascript
2014-09-04 21:17:13 -04:00
{
"type": "openstack",
2014-09-04 21:23:29 -04:00
"ssh_username": "root",
2014-09-04 21:17:13 -04:00
"image_name": "ubuntu1404_packer_test_1",
"source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
"flavor": "2"
}
2014-10-20 13:55:16 -04:00
```
2014-09-04 21:17:13 -04:00
In this case, the connection information for connecting to OpenStack
doesn't appear in the template. That is because I source a standard
OpenStack script with environment variables set before I run this. This
script is setting environment variables like:
2014-09-04 21:23:29 -04:00
* `OS_AUTH_URL`
* `OS_TENANT_ID`
* `OS_USERNAME`
* `OS_PASSWORD`