github.com/askholme/packer@v0.7.2-0.20140924152349-70d9566a6852/website/source/docs/builders/openstack.html.markdown (about)

     1  ---
     2  layout: "docs"
     3  page_title: "OpenStack Builder"
     4  ---
     5  
     6  # OpenStack Builder
     7  
     8  Type: `openstack`
     9  
    10  The `openstack` builder is able to create new images for use with
    11  [OpenStack](http://www.openstack.org). The builder takes a source
    12  image, runs any provisioning necessary on the image after launching it,
    13  then creates a new reusable image. This reusable image can then be
    14  used as the foundation of new servers that are launched within OpenStack.
    15  The builder will create temporary keypairs that provide temporary access to
    16  the server while the image is being created. This simplifies configuration
    17  quite a bit.
    18  
    19  The builder does _not_ manage images. Once it creates an image, it is up to
    20  you to use it or delete it.
    21  
    22  ## Configuration Reference
    23  
    24  There are many configuration options available for the builder. They are
    25  segmented below into two categories: required and optional parameters. Within
    26  each category, the available configuration keys are alphabetized.
    27  
    28  ### Required:
    29  
    30  * `flavor` (string) - The ID or full URL for the desired flavor for the
    31    server to be created.
    32  
    33  * `image_name` (string) - The name of the resulting image.
    34  
    35  * `password` (string) - The password used to connect to the OpenStack service.
    36    If not specified, Packer will use the environment variables
    37    `SDK_PASSWORD` or `OS_PASSWORD` (in that order), if set.
    38  
    39  * `provider` (string) - The provider used to connect to the OpenStack service.
    40    If not specified, Packer will use the environment variable
    41    `SDK_PROVIDER`, if set.
    42    For Rackspace this should be `rackspace-us` or `rackspace-uk`.
    43  
    44  * `source_image` (string) - The ID or full URL to the base image to use.
    45    This is the image that will be used to launch a new server and provision it.
    46  
    47  * `username` (string) - The username used to connect to the OpenStack service.
    48    If not specified, Packer will use the environment variables
    49    `SDK_USERNAME` or `OS_USERNAME` (in that order), if set.
    50  
    51  ### Optional:
    52  
    53  * `api_key` (string) - The API key used to access OpenStack. Some OpenStack
    54    installations require this.
    55    If not specified, Packer will use the environment variables
    56    `SDK_API_KEY`, if set.
    57  
    58  * `floating_ip` (string) - A specific floating IP to assign to this instance.
    59    `use_floating_ip` must also be set to true for this to have an affect.
    60  
    61  * `floating_ip_pool` (string) - The name of the floating IP pool to use
    62    to allocate a floating IP. `use_floating_ip` must also be set to true
    63    for this to have an affect.
    64  
    65  * `insecure` (boolean) - Whether or not the connection to OpenStack can be done
    66    over an insecure connection. By default this is false.
    67  
    68  * `networks` (array of strings) - A list of networks by UUID to attach
    69    to this instance.
    70  
    71  * `openstack_provider` (string)
    72  <!---
    73  @todo document me
    74  -->
    75  
    76  * `project` (string) - The project name to boot the instance into. Some
    77    OpenStack installations require this.
    78    If not specified, Packer will use the environment variables
    79    `SDK_PROJECT` or `OS_TENANT_NAME` (in that order), if set.
    80  
    81  * `provider` (string) - A name of a provider that has a slightly
    82    different API model. Currently supported values are "openstack" (default),
    83    and "rackspace".
    84    If not specified, Packer will use the environment variables
    85    `SDK_PROVIDER` or `OS_AUTH_URL` (in that order), if set.
    86  
    87  * `proxy_url` (string)
    88  <!---
    89  @todo document me
    90  -->
    91  * `security_groups` (array of strings) - A list of security groups by name
    92    to add to this instance.
    93  
    94  * `region` (string) - The name of the region, such as "DFW", in which
    95    to launch the server to create the AMI.
    96    If not specified, Packer will use the environment variables
    97    `SDK_REGION` or `OS_REGION_NAME` (in that order), if set.
    98    For a `provider` of "rackspace", it is required to specify a region,
    99    either using this option or with an environment variable. For other
   100    providers, including a private cloud, specifying a region is optional.
   101  
   102  * `ssh_port` (integer) - The port that SSH will be available on. Defaults to port
   103    22.
   104  
   105  * `ssh_timeout` (string) - The time to wait for SSH to become available
   106    before timing out. The format of this value is a duration such as "5s"
   107    or "1m". The default SSH timeout is "5m".
   108  
   109  * `ssh_username` (string) - The username to use in order to communicate
   110    over SSH to the running server. The default is "root".
   111  
   112  * `tenant_id` (string) - Tenant ID for accessing OpenStack if your
   113    installation requires this.
   114  
   115  * `use_floating_ip` (boolean) - Whether or not to use a floating IP for
   116    the instance. Defaults to false.
   117  
   118  ## Basic Example: Rackspace public cloud
   119  
   120  Here is a basic example. This is a working example to build a
   121  Ubuntu 12.04 LTS (Precise Pangolin) on Rackspace OpenStack cloud offering.
   122  
   123  <pre class="prettyprint">
   124  {
   125    "type": "openstack",
   126    "username": "",
   127    "api_key": "",
   128    "openstack_provider": "rackspace",
   129    "provider": "rackspace-us",
   130    "openstack_provider":"rackspace",
   131    "region": "DFW",
   132    "ssh_username": "root",
   133    "image_name": "Test image",
   134    "source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
   135    "flavor": "2"
   136  }
   137  </pre>
   138  
   139  ## Basic Example: Private OpenStack cloud
   140  
   141  This example builds an Ubuntu 14.04 image on a private OpenStack cloud,
   142  powered by Metacloud.
   143  
   144  <pre class="prettyprint">
   145  {
   146    "type": "openstack",
   147    "ssh_username": "root",
   148    "image_name": "ubuntu1404_packer_test_1",
   149    "source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
   150    "flavor": "2"
   151  }
   152  </pre>
   153  
   154  In this case, the connection information for connecting to OpenStack
   155  doesn't appear in the template. That is because I source a standard
   156  OpenStack script with environment variables set before I run this. This
   157  script is setting environment variables like:
   158  
   159  * `OS_AUTH_URL`
   160  * `OS_TENANT_ID`
   161  * `OS_USERNAME`
   162  * `OS_PASSWORD`
   163  
   164  ## Troubleshooting
   165  
   166  *I get the error "Missing or incorrect provider"*
   167  
   168  * Verify your "username", "password" and "provider" settings.
   169  
   170  *I get the error "Missing endpoint, or insufficient privileges to access endpoint"*
   171  
   172  * Verify your "region" setting.