github.com/kimor79/packer@v0.8.7-0.20151221212622-d507b18eb4cf/website/source/docs/builders/openstack.html.markdown (about)

     1  ---
     2  description: |
     3      The `openstack` Packer builder is able to create new images for use with
     4      OpenStack. The builder takes a source image, runs any provisioning necessary on
     5      the image after launching it, then creates a new reusable image. This reusable
     6      image can then be used as the foundation of new servers that are launched within
     7      OpenStack. The builder will create temporary keypairs that provide temporary
     8      access to the server while the image is being created. This simplifies
     9      configuration quite a bit.
    10  layout: docs
    11  page_title: OpenStack Builder
    12  ...
    13  
    14  # OpenStack Builder
    15  
    16  Type: `openstack`
    17  
    18  The `openstack` Packer builder is able to create new images for use with
    19  [OpenStack](http://www.openstack.org). The builder takes a source image, runs
    20  any provisioning necessary on the image after launching it, then creates a new
    21  reusable image. This reusable image can then be used as the foundation of new
    22  servers that are launched within OpenStack. The builder will create temporary
    23  keypairs that provide temporary access to the server while the image is being
    24  created. This simplifies configuration quite a bit.
    25  
    26  The builder does *not* manage images. Once it creates an image, it is up to you
    27  to use it or delete it.
    28  
    29  ## Configuration Reference
    30  
    31  There are many configuration options available for the builder. They are
    32  segmented below into two categories: required and optional parameters. Within
    33  each category, the available configuration keys are alphabetized.
    34  
    35  In addition to the options listed here, a
    36  [communicator](/docs/templates/communicator.html) can be configured for this
    37  builder.
    38  
    39  ### Required:
    40  
    41  -   `flavor` (string) - The ID, name, or full URL for the desired flavor for the
    42      server to be created.
    43  
    44  -   `image_name` (string) - The name of the resulting image.
    45  
    46  -   `source_image` (string) - The ID or full URL to the base image to use. This
    47      is the image that will be used to launch a new server and provision it.
    48      Unless you specify completely custom SSH settings, the source image must
    49      have `cloud-init` installed so that the keypair gets assigned properly.
    50  
    51  -   `username` (string) - The username used to connect to the OpenStack service.
    52      If not specified, Packer will use the environment variable `OS_USERNAME`,
    53      if set.
    54  
    55  -   `password` (string) - The password used to connect to the OpenStack service.
    56      If not specified, Packer will use the environment variables `OS_PASSWORD`,
    57      if set.
    58  
    59  ### Optional:
    60  
    61  -   `api_key` (string) - The API key used to access OpenStack. Some OpenStack
    62      installations require this.
    63  
    64  -   `availability_zone` (string) - The availability zone to launch the
    65      server in. If this isn't specified, the default enforced by your OpenStack
    66      cluster will be used. This may be required for some OpenStack clusters.
    67  
    68  -   `floating_ip` (string) - A specific floating IP to assign to this instance.
    69      `use_floating_ip` must also be set to true for this to have an affect.
    70  
    71  -   `floating_ip_pool` (string) - The name of the floating IP pool to use to
    72      allocate a floating IP. `use_floating_ip` must also be set to true for this
    73      to have an affect.
    74  
    75  -   `insecure` (boolean) - Whether or not the connection to OpenStack can be
    76      done over an insecure connection. By default this is false.
    77  
    78  -   `networks` (array of strings) - A list of networks by UUID to attach to
    79      this instance.
    80  
    81  -   `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the
    82      instance into. Some OpenStack installations require this. If not specified,
    83      Packer will use the environment variable `OS_TENANT_NAME`, if set.
    84  
    85  -   `security_groups` (array of strings) - A list of security groups by name to
    86      add to this instance.
    87  
    88  -   `region` (string) - The name of the region, such as "DFW", in which to
    89      launch the server to create the AMI. If not specified, Packer will use the
    90      environment variable `OS_REGION_NAME`, if set.
    91  
    92  -   `ssh_interface` (string) - The type of interface to connect via SSH. Values
    93      useful for Rackspace are "public" or "private", and the default behavior is
    94      to connect via whichever is returned first from the OpenStack API.
    95  
    96  -   `use_floating_ip` (boolean) - Whether or not to use a floating IP for
    97      the instance. Defaults to false.
    98  
    99  -   `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
   100      Rackconnect to assign the machine an IP address before connecting via SSH.
   101      Defaults to false.
   102  
   103  -   `metadata` (object of key/value strings) - Glance metadata that will be
   104      applied to the image.
   105  
   106  -   `config_drive` (boolean) - Whether or not nova should use ConfigDrive for
   107       cloud-init metadata.
   108  
   109  ## Basic Example: Rackspace public cloud
   110  
   111  Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
   112  (Precise Pangolin) on Rackspace OpenStack cloud offering.
   113  
   114  ``` {.javascript}
   115  {
   116    "type": "openstack",
   117    "username": "foo",
   118    "password": "foo",
   119    "region": "DFW",
   120    "ssh_username": "root",
   121    "image_name": "Test image",
   122    "source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
   123    "flavor": "2"
   124  }
   125  ```
   126  
   127  ## Basic Example: Private OpenStack cloud
   128  
   129  This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered
   130  by Metacloud.
   131  
   132  ``` {.javascript}
   133  {
   134    "type": "openstack",
   135    "ssh_username": "root",
   136    "image_name": "ubuntu1404_packer_test_1",
   137    "source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
   138    "flavor": "2"
   139  }
   140  ```
   141  
   142  In this case, the connection information for connecting to OpenStack doesn't
   143  appear in the template. That is because I source a standard OpenStack script
   144  with environment variables set before I run this. This script is setting
   145  environment variables like:
   146  
   147  -   `OS_AUTH_URL`
   148  -   `OS_TENANT_ID`
   149  -   `OS_USERNAME`
   150  -   `OS_PASSWORD`