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