github.com/StackPointCloud/packer@v0.10.2-0.20180716202532-b28098e0f79b/website/source/docs/builders/cloudstack.html.md (about) 1 --- 2 description: | 3 The cloudstack Packer builder is able to create new templates for use with 4 CloudStack. The builder takes either an ISO or an existing template as it's 5 source, runs any provisioning necessary on the instance after launching it and 6 then creates a new template from that instance. 7 layout: docs 8 page_title: 'CloudStack - Builders' 9 sidebar_current: 'docs-builders-cloudstack' 10 --- 11 12 # CloudStack Builder 13 14 Type: `cloudstack` 15 16 The `cloudstack` Packer builder is able to create new templates for use with 17 [CloudStack](https://cloudstack.apache.org/). The builder takes either an ISO 18 or an existing template as it's source, runs any provisioning necessary on the 19 instance after launching it and then creates a new template from that instance. 20 21 The builder does *not* manage templates. Once a template is created, it is up 22 to you to use it or delete it. 23 24 ## Configuration Reference 25 26 There are many configuration options available for the builder. They are 27 segmented below into two categories: required and optional parameters. Within 28 each category, the available configuration keys are alphabetized. 29 30 In addition to the options listed here, a 31 [communicator](/docs/templates/communicator.html) can be configured for this 32 builder. 33 34 ### Required: 35 36 - `api_url` (string) - The CloudStack API endpoint we will connect to. 37 It can also be specified via environment variable `CLOUDSTACK_API_URL`, 38 if set. 39 40 - `api_key` (string) - The API key used to sign all API requests. It 41 can also be specified via environment variable `CLOUDSTACK_API_KEY`, 42 if set. 43 44 - `network` (string) - The name or ID of the network to connect the instance 45 to. 46 47 - `secret_key` (string) - The secret key used to sign all API requests. 48 It can also be specified via environment variable `CLOUDSTACK_SECRET_KEY`, 49 if set. 50 51 - `service_offering` (string) - The name or ID of the service offering used 52 for the instance. 53 54 - `source_iso` (string) - The name or ID of an ISO that will be mounted before 55 booting the instance. This option is mutually exclusive with `source_template`. 56 When using `source_iso`, both `disk_offering` and `hypervisor` are required. 57 58 - `source_template` (string) - The name or ID of the template used as base 59 template for the instance. This option is mutually exclusive with `source_iso`. 60 61 - `template_os` (string) - The name or ID of the template OS for the new 62 template that will be created. 63 64 - `zone` (string) - The name or ID of the zone where the instance will be 65 created. 66 67 ### Optional: 68 69 - `async_timeout` (number) - The time duration to wait for async calls to 70 finish. Defaults to 30m. 71 72 - `cidr_list` (array) - List of CIDR's that will have access to the new 73 instance. This is needed in order for any provisioners to be able to 74 connect to the instance. Defaults to `[ "0.0.0.0/0" ]`. Only required 75 when `use_local_ip_address` is `false`. 76 77 - `create_security_group` (boolean) - If `true` a temporary security group 78 will be created which allows traffic towards the instance from the 79 `cidr_list`. This option will be ignored if `security_groups` is also 80 defined. Requires `expunge` set to `true`. Defaults to `false`. 81 82 - `disk_offering` (string) - The name or ID of the disk offering used for the 83 instance. This option is only available (and also required) when using 84 `source_iso`. 85 86 - `disk_size` (number) - The size (in GB) of the root disk of the new instance. 87 This option is only available when using `source_template`. 88 89 - `expunge` (boolean) - Set to `true` to expunge the instance when it is 90 destroyed. Defaults to `false`. 91 92 - `http_directory` (string) - Path to a directory to serve using an 93 HTTP server. The files in this directory will be available over HTTP that 94 will be requestable from the virtual machine. This is useful for hosting 95 kickstart files and so on. By default this is "", which means no HTTP server 96 will be started. The address and port of the HTTP server will be available 97 as variables in `user_data`. This is covered in more detail below. 98 99 - `http_get_only` (boolean) - Some cloud providers only allow HTTP GET calls to 100 their CloudStack API. If using such a provider, you need to set this to `true` 101 in order for the provider to only make GET calls and no POST calls. 102 103 - `http_port_min` and `http_port_max` (number) - These are the minimum and 104 maximum port to use for the HTTP server started to serve the 105 `http_directory`. Because Packer often runs in parallel, Packer will choose 106 a randomly available port in this range to run the HTTP server. If you want 107 to force the HTTP server to be on one port, make this minimum and maximum 108 port the same. By default the values are 8000 and 9000, respectively. 109 110 - `hypervisor` (string) - The target hypervisor (e.g. `XenServer`, `KVM`) for 111 the new template. This option is required when using `source_iso`. 112 113 - `keypair` (string) - The name of the SSH key pair that will be used to 114 access the instance. The SSH key pair is assumed to be already available 115 within CloudStack. 116 117 - `instance_name` (string) - The name of the instance. Defaults to 118 "packer-UUID" where UUID is dynamically generated. 119 120 - `prevent_firewall_changes` (boolean) - Set to `true` to prevent network ACLs 121 or firewall rules creation. Defaults to `false`. 122 123 - `project` (string) - The name or ID of the project to deploy the instance to. 124 125 - `public_ip_address` (string) - The public IP address or it's ID used for 126 connecting any provisioners to. If not provided, a temporary public IP 127 address will be associated and released during the Packer run. 128 129 - `security_groups` (array of strings) - A list of security group IDs or names 130 to associate the instance with. 131 132 - `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to 133 authenticate connections to the source instance. No temporary keypair will 134 be created, and the values of `ssh_password` and `ssh_private_key_file` will 135 be ignored. To use this option with a key pair already configured in the source 136 image, leave the `keypair` blank. To associate an existing key pair 137 with the source instance, set the `keypair` field to the name of the key pair. 138 139 - `ssl_no_verify` (boolean) - Set to `true` to skip SSL verification. Defaults 140 to `false`. 141 142 - `template_display_text` (string) - The display text of the new template. 143 Defaults to the `template_name`. 144 145 - `template_featured` (boolean) - Set to `true` to indicate that the template 146 is featured. Defaults to `false`. 147 148 - `template_name` (string) - The name of the new template. Defaults to 149 "packer-{{timestamp}}" where timestamp will be the current time. 150 151 - `template_public` (boolean) - Set to `true` to indicate that the template is 152 available for all accounts. Defaults to `false`. 153 154 - `template_password_enabled` (boolean) - Set to `true` to indicate the template 155 should be password enabled. Defaults to `false`. 156 157 - `template_requires_hvm` (boolean) - Set to `true` to indicate the template 158 requires hardware-assisted virtualization. Defaults to `false`. 159 160 - `template_scalable` (boolean) - Set to `true` to indicate that the template 161 contains tools to support dynamic scaling of VM cpu/memory. Defaults to `false`. 162 163 - `temporary_keypair_name` (string) - The name of the temporary SSH key pair 164 to generate. By default, Packer generates a name that looks like 165 `packer_<UUID>`, where <UUID> is a 36 character unique identifier. 166 167 - `user_data` (string) - User data to launch with the instance. This is a 168 [template engine](/docs/templates/engine.html) see _User Data_ bellow for more 169 details. 170 171 - `user_data_file` (string) - Path to a file that will be used for the user 172 data when launching the instance. This file will be parsed as a 173 [template engine](/docs/templates/engine.html) see _User Data_ bellow for more 174 details. 175 176 - `use_local_ip_address` (boolean) - Set to `true` to indicate that the 177 provisioners should connect to the local IP address of the instance. 178 179 ## User Data 180 181 The available variables are: 182 183 - `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server 184 that is started serving the directory specified by the `http_directory` 185 configuration parameter. If `http_directory` isn't specified, these will be 186 blank. 187 188 ## Basic Example 189 190 Here is a basic example. 191 192 ``` json 193 { 194 "type": "cloudstack", 195 "api_url": "https://cloudstack.company.com/client/api", 196 "api_key": "YOUR_API_KEY", 197 "secret_key": "YOUR_SECRET_KEY", 198 199 "disk_offering": "Small - 20GB", 200 "hypervisor": "KVM", 201 "network": "management", 202 "service_offering": "small", 203 "source_iso": "CentOS-7.0-1406-x86_64-Minimal", 204 "zone": "NL1", 205 206 "ssh_username": "root", 207 208 "template_name": "Centos7-x86_64-KVM-Packer", 209 "template_display_text": "Centos7-x86_64 KVM Packer", 210 "template_featured": true, 211 "template_password_enabled": true, 212 "template_scalable": true, 213 "template_os": "Other PV (64-bit)" 214 } 215 ```