github.com/kikitux/packer@v0.10.1-0.20160322154024-6237df566f9f/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.g. 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 - `api_key` (string) - The API key used to access OpenStack. Some OpenStack 77 installations require this. 78 79 - `availability_zone` (string) - The availability zone to launch the 80 server in. If this isn't specified, the default enforced by your OpenStack 81 cluster will be used. This may be required for some OpenStack clusters. 82 83 - `config_drive` (boolean) - Whether or not nova should use ConfigDrive for 84 cloud-init metadata. 85 86 - `domain_name` or `domain_id` (string) - The Domain name or ID you are 87 authenticating with. OpenStack installations require this if identity v3 is used. 88 Packer will use the environment variable `OS_DOMAIN_NAME` or `OS_DOMAIN_ID`, if set. 89 90 - `endpoint_type` (string) - The endpoint type to use. Can be any of "internal", 91 "internalURL", "admin", "adminURL", "public", and "publicURL". By default 92 this is "public". 93 94 - `floating_ip` (string) - A specific floating IP to assign to this instance. 95 96 - `floating_ip_pool` (string) - The name of the floating IP pool to use to 97 allocate a floating IP. 98 99 - `insecure` (boolean) - Whether or not the connection to OpenStack can be 100 done over an insecure connection. By default this is false. 101 102 - `metadata` (object of key/value strings) - Glance metadata that will be 103 applied to the image. 104 105 - `networks` (array of strings) - A list of networks by UUID to attach to 106 this instance. 107 108 - `rackconnect_wait` (boolean) - For rackspace, whether or not to wait for 109 Rackconnect to assign the machine an IP address before connecting via SSH. 110 Defaults to false. 111 112 - `region` (string) - The name of the region, such as "DFW", in which to 113 launch the server to create the AMI. If not specified, Packer will use the 114 environment variable `OS_REGION_NAME`, if set. 115 116 - `security_groups` (array of strings) - A list of security groups by name to 117 add to this instance. 118 119 - `ssh_interface` (string) - The type of interface to connect via SSH. Values 120 useful for Rackspace are "public" or "private", and the default behavior is 121 to connect via whichever is returned first from the OpenStack API. 122 123 - `ssh_ip_version` (string) - The IP version to use for SSH connections, valid 124 values are `4` and `6`. Useful on dual stacked instances where the default 125 behaviour is to connect via whichever IP address is returned first from the 126 OpenStack API. 127 128 - `ssh_keypair_name` (string) - If specified, this is the key that will be 129 used for SSH with the machine. By default, this is blank, and Packer will 130 generate a temporary keypair. 131 [`ssh_private_key_file`](/docs/templates/communicator.html#ssh_private_key_file) 132 must be specified with this. 133 134 - `tenant_id` or `tenant_name` (string) - The tenant ID or name to boot the 135 instance into. Some OpenStack installations require this. If not specified, 136 Packer will use the environment variable `OS_TENANT_NAME`, if set. Tenant 137 is also called Project in later versions of OpenStack. 138 139 - `use_floating_ip` (boolean) - _Deprecated_ use `floating_ip` or `floating_ip_pool` 140 instead. 141 142 - `user_data` (string) - User data to apply when launching the instance. Note 143 that you need to be careful about escaping characters due to the templates 144 being JSON. It is often more convenient to use `user_data_file`, instead. 145 146 - `user_data_file` (string) - Path to a file that will be used for the user 147 data when launching the instance. 148 149 ## Basic Example: DevStack 150 151 Here is a basic example. This is a example to build on DevStack running in a VM. 152 153 ``` {.javascript} 154 { 155 "type": "openstack", 156 "identity_endpoint": "http://<destack-ip>:5000/v3", 157 "tenant_name": "admin", 158 "domain_name": "Default", 159 "username": "admin", 160 "password": "<your admin password>", 161 "region": "RegionOne", 162 "ssh_username": "root", 163 "image_name": "Test image", 164 "source_image": "<image id>", 165 "flavor": "m1.tiny", 166 "insecure": "true" 167 } 168 169 ``` 170 171 ## Basic Example: Rackspace public cloud 172 173 Here is a basic example. This is a working example to build a Ubuntu 12.04 LTS 174 (Precise Pangolin) on Rackspace OpenStack cloud offering. 175 176 ``` {.javascript} 177 { 178 "type": "openstack", 179 "username": "foo", 180 "password": "foo", 181 "region": "DFW", 182 "ssh_username": "root", 183 "image_name": "Test image", 184 "source_image": "23b564c9-c3e6-49f9-bc68-86c7a9ab5018", 185 "flavor": "2" 186 } 187 ``` 188 189 ## Basic Example: Private OpenStack cloud 190 191 This example builds an Ubuntu 14.04 image on a private OpenStack cloud, powered 192 by Metacloud. 193 194 ``` {.javascript} 195 { 196 "type": "openstack", 197 "ssh_username": "root", 198 "image_name": "ubuntu1404_packer_test_1", 199 "source_image": "91d9c168-d1e5-49ca-a775-3bfdbb6c97f1", 200 "flavor": "2" 201 } 202 ``` 203 204 In this case, the connection information for connecting to OpenStack doesn't 205 appear in the template. That is because I source a standard OpenStack script 206 with environment variables set before I run this. This script is setting 207 environment variables like: 208 209 - `OS_AUTH_URL` 210 - `OS_TENANT_ID` 211 - `OS_USERNAME` 212 - `OS_PASSWORD` 213 214 This is slightly different when identity v3 is used: 215 216 - `OS_AUTH_URL` 217 - `OS_USERNAME` 218 - `OS_PASSWORD` 219 - `OS_DOMAIN_NAME` 220 - `OS_TENANT_NAME` 221 222 This will authenticate the user on the domain and scope you to the project. 223 A tenant is the same as a project. It's optional to use names or IDs in v3. 224 This means you can use `OS_USERNAME` or `OS_USERID`, `OS_TENANT_ID` or 225 `OS_TENANT_NAME` and `OS_DOMAIN_ID` or `OS_DOMAIN_NAME`. 226 227 The above example would be equivalent to an RC file looking like this : 228 229 export OS_AUTH_URL="https://identity.myprovider/v3" 230 export OS_USERNAME="myuser" 231 export OS_PASSWORD="password" 232 export OS_USER_DOMAIN_NAME="mydomain" 233 export OS_PROJECT_DOMAIN_NAME="mydomain" 234 235 ## Notes on OpenStack Authorization 236 237 The simplest way to get all settings for authorization agains OpenStack is to 238 go into the OpenStack Dashboard (Horizon) select your _Project_ and navigate 239 _Project, Access & Security_, select _API Access_ and _Download OpenStack RC 240 File v3_. Source the file, and select your wanted region by setting 241 environment variable `OS_REGION_NAME` or `OS_REGION_ID` and `export 242 OS_TENANT_NAME=$OS_PROJECT_NAME` or `export OS_TENANT_ID=$OS_PROJECT_ID`. 243 244 \~> `OS_TENANT_NAME` or `OS_TENANT_ID` must be used even with Identity v3, 245 `OS_PROJECT_NAME` and `OS_PROJECT_ID` has no effect in Packer. 246 247 To troubleshoot authorization issues test you environment variables with the 248 OpenStack cli. It can be installed with 249 ```pip install --user python-openstackclient```.