github.com/mmcquillan/packer@v1.1.1-0.20171009221028-c85cf0483a5d/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` (int) - 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` (int) - 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` (integer) - 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  -   `project` (string) - The name or ID of the project to deploy the instance to.
   121  
   122  -   `public_ip_address` (string) - The public IP address or it's ID used for
   123      connecting any provisioners to. If not provided, a temporary public IP
   124      address will be associated and released during the Packer run.
   125  
   126  -   `security_groups` (array of strings) - A list of security group IDs or names
   127      to associate the instance with.
   128  
   129  -   `ssh_agent_auth` (boolean) - If true, the local SSH agent will be used to
   130      authenticate connections to the source instance. No temporary keypair will
   131      be created, and the values of `ssh_password` and `ssh_private_key_file` will
   132      be ignored. To use this option with a key pair already configured in the source
   133      image, leave the `keypair` blank. To associate an existing key pair
   134      with the source instance, set the `keypair` field to the name of the key pair.
   135  
   136  -   `ssl_no_verify` (boolean) - Set to `true` to skip SSL verification. Defaults
   137      to `false`.
   138  
   139  -   `template_display_text` (string) - The display text of the new template.
   140      Defaults to the `template_name`.
   141  
   142  -   `template_featured` (boolean) - Set to `true` to indicate that the template
   143      is featured. Defaults to `false`.
   144  
   145  -   `template_name` (string) - The name of the new template. Defaults to
   146      "packer-{{timestamp}}" where timestamp will be the current time.
   147  
   148  -   `template_public` (boolean) - Set to `true` to indicate that the template is
   149      available for all accounts. Defaults to `false`.
   150  
   151  -   `template_password_enabled` (boolean) - Set to `true` to indicate the template
   152      should be password enabled. Defaults to `false`.
   153  
   154  -   `template_requires_hvm` (boolean) - Set to `true` to indicate the template
   155      requires hardware-assisted virtualization. Defaults to `false`.
   156  
   157  -   `template_scalable` (boolean) - Set to `true` to indicate that the template
   158      contains tools to support dynamic scaling of VM cpu/memory. Defaults to `false`.
   159  
   160  -   `temporary_keypair_name` (string) - The name of the temporary SSH key pair
   161      to generate. By default, Packer generates a name that looks like
   162      `packer_<UUID>`, where &lt;UUID&gt; is a 36 character unique identifier.
   163  
   164  -   `user_data` (string) - User data to launch with the instance. This is a
   165      [template engine](/docs/templates/engine.html) see _User Data_ bellow for more
   166      details.
   167  
   168  -   `user_data_file` (string) - Path to a file that will be used for the user
   169      data when launching the instance. This file will be parsed as a
   170      [template engine](/docs/templates/engine.html) see _User Data_ bellow for more
   171      details.
   172  
   173  -   `use_local_ip_address` (boolean) - Set to `true` to indicate that the
   174      provisioners should connect to the local IP address of the instance.
   175  
   176  ## User Data
   177  
   178  The available variables are:
   179  
   180  -  `HTTPIP` and `HTTPPort` - The IP and port, respectively of an HTTP server
   181      that is started serving the directory specified by the `http_directory`
   182      configuration parameter. If `http_directory` isn't specified, these will be
   183      blank.
   184  
   185  ## Basic Example
   186  
   187  Here is a basic example.
   188  
   189  ``` json
   190  {
   191    "type": "cloudstack",
   192    "api_url": "https://cloudstack.company.com/client/api",
   193    "api_key": "YOUR_API_KEY",
   194    "secret_key": "YOUR_SECRET_KEY",
   195  
   196    "disk_offering": "Small - 20GB",
   197    "hypervisor": "KVM",
   198    "network": "management",
   199    "service_offering": "small",
   200    "source_iso": "CentOS-7.0-1406-x86_64-Minimal",
   201    "zone": "NL1",
   202  
   203    "ssh_username": "root",
   204  
   205    "template_name": "Centos7-x86_64-KVM-Packer",
   206    "template_display_text": "Centos7-x86_64 KVM Packer",
   207    "template_featured": true,
   208    "template_password_enabled": true,
   209    "template_scalable": true,
   210    "template_os": "Other PV (64-bit)"
   211  }
   212  ```