github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/website/source/docs/builders/openstack.html.md (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  \~> **OpenStack Liberty or later requires OpenSSL!** To use the OpenStack
    30  builder with OpenStack Liberty (Oct 2015) or later you need to have OpenSSL
    31  installed _if you are using temporary key pairs_, i.e. don't use
    32  [`ssh_keypair_name`](openstack.html#ssh_keypair_name) nor
    33  [`ssh_password`](/docs/templates/communicator.html#ssh_password). All major
    34  OS'es have OpenSSL installed by default except Windows.
    35  
    36  ## Configuration Reference
    37  
    38  There are many configuration options available for the builder. They are
    39  segmented below into two categories: required and optional parameters. Within
    40  each category, the available configuration keys are alphabetized.
    41  
    42  In addition to the options listed here, a
    43  [communicator](/docs/templates/communicator.html) can be configured for this
    44  builder.
    45  
    46  ### Required:
    47  
    48  -   `flavor` (string) - The ID, name, or full URL for the desired flavor for the
    49      server to be created.
    50  
    51  -   `image_name` (string) - The name of the resulting image.
    52  
    53  -   `identity_endpoint` (string) - The URL to the OpenStack Identity service.
    54      If not specified, Packer will use the environment variables `OS_AUTH_URL`,
    55      if set.
    56  
    57  -   `source_image` (string) - The ID or full URL to the base image to use. This
    58      is the image that will be used to launch a new server and provision it.
    59      Unless you specify completely custom SSH settings, the source image must
    60      have `cloud-init` installed so that the keypair gets assigned properly.
    61  
    62  -   `source_image_name` (string) - The name of the base image to use. This
    63      is an alternative way of providing `source_image` and only either of them
    64      can be specified.
    65  
    66  -   `username` or `user_id` (string) - The username or id used to connect to
    67      the OpenStack service. If not specified, Packer will use the environment
    68      variable `OS_USERNAME` or `OS_USERID`, if set.
    69  
    70  -   `password` (string) - The password used to connect to the OpenStack service.
    71      If not specified, Packer will use the environment variables `OS_PASSWORD`,
    72      if set.
    73  
    74  ### Optional:
    75  
    76  -   `availability_zone` (string) - The availability zone to launch the
    77      server in. If this isn't specified, the default enforced by your OpenStack
    78      cluster will be used. This may be required for some OpenStack clusters.
    79  
    80  -   `config_drive` (boolean) - Whether or not nova should use ConfigDrive for
    81       cloud-init metadata.
    82  
    83  -   `domain_name` or `domain_id` (string) - The Domain name or ID you are
    84      authenticating with. OpenStack installations require this if identity v3 is used.
    85      Packer will use the environment variable `OS_DOMAIN_NAME` or `OS_DOMAIN_ID`, if set.
    86  
    87  -   `endpoint_type` (string) - The endpoint type to use. Can be any of "internal",
    88      "internalURL", "admin", "adminURL", "public", and "publicURL". By default
    89      this is "public".
    90  
    91  -   `floating_ip` (string) - A specific floating IP to assign to this instance.
    92  
    93  -   `floating_ip_pool` (string) - The name of the floating IP pool to use to
    94      allocate a floating IP.
    95  
    96  -   `image_members` (array of strings) - List of members to add to the image
    97      after creation. An image member is usually a project (also called the
    98      “tenant”) with whom the image is shared.
    99  
   100  -   `image_visibility` (string) - One of "public", "private", "shared", or
   101      "community".
   102  
   103  -   `insecure` (boolean) - Whether or not the connection to OpenStack can be
   104      done over an insecure connection. By default this is false.
   105  
   106  -   `metadata` (object of key/value strings) - Glance metadata that will be
   107      applied to the image.
   108  
   109  -   `networks` (array of strings) - A list of networks by UUID to attach to
   110      this instance.
   111  
   112  -   `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for
   113      Rackconnect to assign the machine an IP address before connecting via SSH.
   114      Defaults to false.
   115  
   116  -   `region` (string) - The name of the region, such as "DFW", in which to
   117      launch the server to create the AMI. If not specified, Packer will use the
   118      environment variable `OS_REGION_NAME`, if set.
   119  
   120  -   `security_groups` (array of strings) - A list of security groups by name to
   121      add to this instance.
   122  
   123  -   `ssh_interface` (string) - The type of interface to connect via SSH. Values
   124      useful for Rackspace are "public" or "private", and the default behavior is
   125      to connect via whichever is returned first from the OpenStack API.
   126  
   127  -   `ssh_ip_version` (string) - The IP version to use for SSH connections, valid
   128      values are `4` and `6`. Useful on dual stacked instances where the default
   129      behavior is to connect via whichever IP address is returned first from the
   130      OpenStack API.
   131  
   132  -   `ssh_keypair_name` (string) - If specified, this is the key that will be
   133      used for SSH with the machine. By default, this is blank, and Packer will
   134      generate a temporary keypair.
   135      [`ssh_private_key_file`](/docs/templates/communicator.html#ssh_private_key_file)
   136      must be specified with this.
   137  
   138  -   `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the
   139      instance into. Some OpenStack installations require this. If not specified,
   140      Packer will use the environment variable `OS_TENANT_NAME`, if set. Tenant
   141      is also called Project in later versions of OpenStack.
   142  
   143  -   `use_floating_ip` (boolean) - _Deprecated_ use `floating_ip` or `floating_ip_pool`
   144      instead.
   145  
   146  -   `user_data` (string) - User data to apply when launching the instance. Note
   147      that you need to be careful about escaping characters due to the templates
   148      being JSON. It is often more convenient to use `user_data_file`, instead.
   149  
   150  -   `user_data_file` (string) - Path to a file that will be used for the user
   151      data when launching the instance.
   152  
   153  ## Basic Example: DevStack
   154  
   155  Here is a basic example. This is a example to build on DevStack running in a VM.
   156  
   157  ``` {.javascript}
   158  {
   159    "type": "openstack",
   160    "identity_endpoint": "http://<destack-ip>:5000/v3",
   161    "tenant_name": "admin",
   162    "domain_name": "Default",
   163    "username": "admin",
   164    "password": "<your admin password>",
   165    "region": "RegionOne",
   166    "ssh_username": "root",
   167    "image_name": "Test image",
   168    "source_image": "<image id>",
   169    "flavor": "m1.tiny",
   170    "insecure": "true"
   171  }
   172  
   173  ```
   174  
   175  ## Basic Example: Rackspace public cloud
   176  
   177  Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS
   178  (Precise Pangolin) on Rackspace OpenStack cloud offering.
   179  
   180  ``` {.javascript}
   181  {
   182    "type": "openstack",
   183    "username": "foo",
   184    "password": "foo",
   185    "region": "DFW",
   186    "ssh_username": "root",
   187    "image_name": "Test image",
   188    "source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018",
   189    "flavor": "2"
   190  }
   191  ```
   192  
   193  ## Basic Example: Private OpenStack cloud
   194  
   195  This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered
   196  by Metacloud.
   197  
   198  ``` {.javascript}
   199  {
   200    "type": "openstack",
   201    "ssh_username": "root",
   202    "image_name": "ubuntu1404_packer_test_1",
   203    "source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1",
   204    "flavor": "2"
   205  }
   206  ```
   207  
   208  In this case, the connection information for connecting to OpenStack doesn't
   209  appear in the template. That is because I source a standard OpenStack script
   210  with environment variables set before I run this. This script is setting
   211  environment variables like:
   212  
   213  -   `OS_AUTH_URL`
   214  -   `OS_TENANT_ID`
   215  -   `OS_USERNAME`
   216  -   `OS_PASSWORD`
   217  
   218  This is slightly different when identity v3 is used:
   219  
   220  -   `OS_AUTH_URL`
   221  -   `OS_USERNAME`
   222  -   `OS_PASSWORD`
   223  -   `OS_DOMAIN_NAME`
   224  -   `OS_TENANT_NAME`
   225  
   226  This will authenticate the user on the domain and scope you to the project.
   227  A tenant is the same as a project. It's optional to use names or IDs in v3.
   228  This means you can use `OS_USERNAME` or `OS_USERID`,  `OS_TENANT_ID` or
   229  `OS_TENANT_NAME` and `OS_DOMAIN_ID` or `OS_DOMAIN_NAME`.
   230  
   231  The above example would be equivalent to an RC file looking like this :
   232  
   233      export OS_AUTH_URL="https://identity.myprovider/v3"
   234      export OS_USERNAME="myuser"
   235      export OS_PASSWORD="password"
   236      export OS_USER_DOMAIN_NAME="mydomain"
   237      export OS_PROJECT_DOMAIN_NAME="mydomain"
   238  
   239  ## Notes on OpenStack Authorization
   240  
   241  The simplest way to get all settings for authorization agains OpenStack is to
   242  go into the OpenStack Dashboard (Horizon) select your _Project_ and navigate
   243  _Project, Access & Security_, select _API Access_ and _Download OpenStack RC
   244  File v3_. Source the file, and select your wanted region by setting
   245  environment variable `OS_REGION_NAME` or `OS_REGION_ID` and `export
   246  OS_TENANT_NAME=$OS_PROJECT_NAME` or `export OS_TENANT_ID=$OS_PROJECT_ID`.
   247  
   248  \~&gt; `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3,
   249  `OS_PROJECT_NAME` and `OS_PROJECT_ID` has no effect in Packer.
   250  
   251  To troubleshoot authorization issues test you environment variables with the
   252  OpenStack cli. It can be installed with
   253  ```pip install --user python-openstackclient```.