2013-08-27 01:02:03 -04:00
|
|
|
---
|
|
|
|
layout: "docs"
|
2014-08-21 20:41:35 -04:00
|
|
|
page_title: "OpenStack Builder"
|
2013-08-27 01:02:03 -04:00
|
|
|
---
|
|
|
|
|
|
|
|
# OpenStack Builder
|
|
|
|
|
|
|
|
Type: `openstack`
|
|
|
|
|
|
|
|
The `openstack` builder is able to create new images for use with
|
|
|
|
[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.
|
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
### Required:
|
2013-08-27 01:02:03 -04:00
|
|
|
|
|
|
|
* `flavor` (string) - The ID or full URL for the desired flavor for the
|
|
|
|
server to be created.
|
|
|
|
|
|
|
|
* `image_name` (string) - The name of the resulting image.
|
|
|
|
|
|
|
|
* `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
|
|
|
|
`SDK_PASSWORD` or `OS_PASSWORD` (in that order), if set.
|
2013-08-27 01:02:03 -04:00
|
|
|
|
|
|
|
* `provider` (string) - The provider used to connect to the OpenStack service.
|
2014-05-04 13:47:40 -04:00
|
|
|
If not specified, Packer will use the environment variable
|
|
|
|
`SDK_PROVIDER`, if set.
|
|
|
|
For Rackspace this should be `rackspace-us` or `rackspace-uk`.
|
2013-08-27 01:02:03 -04:00
|
|
|
|
2013-09-01 16:30:36 -04:00
|
|
|
* `region` (string) - The name of the region, such as "DFW", in which
|
2014-05-04 13:47:40 -04:00
|
|
|
to launch the server to create the AMI.
|
|
|
|
If not specified, Packer will use the environment variables
|
|
|
|
`SDK_REGION` or `OS_REGION_NAME` (in that order), if set.
|
2013-09-01 16:30:36 -04:00
|
|
|
|
2013-08-27 01:02:03 -04:00
|
|
|
* `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.
|
|
|
|
|
|
|
|
* `username` (string) - The username used to connect to the OpenStack service.
|
2014-05-04 13:47:40 -04:00
|
|
|
If not specified, Packer will use the environment variables
|
|
|
|
`SDK_USERNAME` or `OS_USERNAME` (in that order), 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.
|
|
|
|
If not specified, Packer will use the environment variables
|
|
|
|
`SDK_API_KEY`, if set.
|
2014-04-22 00:38:09 -04:00
|
|
|
|
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.
|
|
|
|
|
2014-05-04 13:47:40 -04:00
|
|
|
* `openstack_provider` (string)
|
|
|
|
<!---
|
|
|
|
@todo document me
|
|
|
|
-->
|
|
|
|
|
2013-09-02 20:34:37 -04:00
|
|
|
* `project` (string) - The project name to boot the instance into. Some
|
2014-05-04 13:47:40 -04:00
|
|
|
OpenStack installations require this.
|
|
|
|
If not specified, Packer will use the environment variables
|
|
|
|
`SDK_PROJECT` or `OS_TENANT_NAME` (in that order), if set.
|
2014-04-22 00:37:20 -04:00
|
|
|
|
|
|
|
* `provider` (string) - A name of a provider that has a slightly
|
|
|
|
different API model. Currently supported values are "openstack" (default),
|
2014-05-04 13:47:40 -04:00
|
|
|
and "rackspace".
|
|
|
|
If not specified, Packer will use the environment variables
|
|
|
|
`SDK_PROVIDER` or `OS_AUTH_URL` (in that order), if set.
|
|
|
|
|
|
|
|
* `proxy_url` (string)
|
|
|
|
<!---
|
|
|
|
@todo document me
|
|
|
|
-->
|
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-05-04 13:47:40 -04:00
|
|
|
* `ssh_port` (integer) - The port that SSH will be available on. Defaults to port
|
2013-08-27 01:02:03 -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"
|
2013-11-19 17:22:17 -05:00
|
|
|
or "1m". The default SSH timeout is "5m".
|
2013-08-27 01:02:03 -04:00
|
|
|
|
|
|
|
* `ssh_username` (string) - The username to use in order to communicate
|
2013-08-29 22:21:40 -04:00
|
|
|
over SSH to the running server. The default is "root".
|
2013-08-27 01:02:03 -04:00
|
|
|
|
2014-04-30 20:21:15 -04:00
|
|
|
* `tenant_id` (string) - Tenant ID for accessing OpenStack if your
|
|
|
|
installation requires this.
|
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
|
|
|
|
<pre class="prettyprint">
|
|
|
|
{
|
|
|
|
"type": "openstack",
|
|
|
|
"username": "",
|
2014-07-17 20:43:21 -04:00
|
|
|
"api_key": "",
|
|
|
|
"openstack_provider": "rackspace",
|
2014-01-04 16:24:14 -05:00
|
|
|
"provider": "rackspace-us",
|
2014-06-15 03:19:26 -04:00
|
|
|
"openstack_provider":"rackspace",
|
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"
|
|
|
|
}
|
|
|
|
</pre>
|
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.
|
|
|
|
|
|
|
|
<pre class="prettyprint">
|
|
|
|
{
|
|
|
|
"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"
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
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`
|
2014-09-04 21:17:13 -04:00
|
|
|
|
2013-09-01 16:30:36 -04:00
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
*I get the error "Missing or incorrect provider"*
|
|
|
|
|
|
|
|
* Verify your "username", "password" and "provider" settings.
|
|
|
|
|
|
|
|
*I get the error "Missing endpoint, or insufficient privileges to access endpoint"*
|
|
|
|
|
|
|
|
* Verify your "region" setting.
|