237 lines
7.9 KiB
Plaintext
237 lines
7.9 KiB
Plaintext
---
|
|
description: |
|
|
The proxmox image Packer builder is able to create new images for use with
|
|
Proxmox VE. The builder takes a cloud-init enabled virtual machine
|
|
template name, runs any provisioning necessary on the image after
|
|
launching it, then creates a virtual machine template.
|
|
page_title: Proxmox Clone - Builders
|
|
sidebar_title: Clone
|
|
---
|
|
|
|
# Proxmox Builder (from an image)
|
|
|
|
Type: `proxmox-clone`
|
|
Artifact BuilderId: `proxmox.clone`
|
|
|
|
The `proxmox-clone` Packer builder is able to create new images for use with
|
|
[Proxmox](https://www.proxmox.com/en/proxmox-ve). The builder takes a virtual
|
|
machine template, runs any provisioning necessary on the image after launching it,
|
|
then creates a virtual machine template. This template can then be used as to
|
|
create new virtual machines within Proxmox.
|
|
|
|
The builder does _not_ manage templates. Once it creates a template, it is up
|
|
to you to use it or delete it.
|
|
|
|
## Configuration Reference
|
|
|
|
There are many configuration options available for the builder. They are
|
|
segmented below into two categories: required and optional parameters. Within
|
|
each category, the available configuration keys are alphabetized.
|
|
|
|
In addition to the options listed here, a
|
|
[communicator](/docs/templates/legacy_json_templates/communicator) can be configured for this
|
|
builder.
|
|
|
|
If no communicator is defined, an SSH key is generated for use, and is used
|
|
in the image's Cloud-Init settings for provisioning.
|
|
|
|
### Required:
|
|
|
|
- `proxmox_url` (string) - URL to the Proxmox API, including the full path,
|
|
so `https://<server>:<port>/api2/json` for example.
|
|
Can also be set via the `PROXMOX_URL` environment variable.
|
|
|
|
- `username` (string) - Username when authenticating to Proxmox, including
|
|
the realm. For example `user@pve` to use the local Proxmox realm.
|
|
Can also be set via the `PROXMOX_USERNAME` environment variable.
|
|
|
|
- `password` (string) - Password for the user.
|
|
Can also be set via the `PROXMOX_PASSWORD` environment variable.
|
|
|
|
- `node` (string) - Which node in the Proxmox cluster to start the virtual
|
|
machine on during creation.
|
|
|
|
- `clone_vm` (string) - The name of the VM packer should clone and build from.
|
|
|
|
### Optional:
|
|
|
|
- `insecure_skip_tls_verify` (bool) - Skip validating the certificate.
|
|
|
|
- `pool` (string) - Name of resource pool to create virtual machine in.
|
|
|
|
- `vm_name` (string) - Name of the virtual machine during creation. If not
|
|
given, a random uuid will be used.
|
|
|
|
- `vm_id` (int) - The ID used to reference the virtual machine. This will
|
|
also be the ID of the final template. If not given, the next free ID on
|
|
the node will be used.
|
|
|
|
- `memory` (int) - How much memory, in megabytes, to give the virtual
|
|
machine. Defaults to `512`.
|
|
|
|
- `cores` (int) - How many CPU cores to give the virtual machine. Defaults
|
|
to `1`.
|
|
|
|
- `sockets` (int) - How many CPU sockets to give the virtual machine.
|
|
Defaults to `1`
|
|
|
|
- `cpu_type` (string) - The CPU type to emulate. See the Proxmox API
|
|
documentation for the complete list of accepted values. For best
|
|
performance, set this to `host`. Defaults to `kvm64`.
|
|
|
|
- `os` (string) - The operating system. Can be `wxp`, `w2k`, `w2k3`, `w2k8`,
|
|
`wvista`, `win7`, `win8`, `win10`, `l24` (Linux 2.4), `l26` (Linux 2.6+),
|
|
`solaris` or `other`. Defaults to `other`.
|
|
|
|
- `vga` (object) - The graphics adapter to use. Example:
|
|
|
|
```json
|
|
{
|
|
"type": "vmware",
|
|
"memory": 32
|
|
}
|
|
```
|
|
|
|
- `type` (string) - Can be `cirrus`, `none`, `qxl`,`qxl2`, `qxl3`,
|
|
`qxl4`, `serial0`, `serial1`, `serial2`, `serial3`, `std`, `virtio`, `vmware`.
|
|
Defaults to `std`.
|
|
|
|
- `memory` (int) - How much memory to assign.
|
|
|
|
- `network_adapters` (array of objects) - Network adapters attached to the
|
|
virtual machine. Example:
|
|
|
|
```json
|
|
[
|
|
{
|
|
"model": "virtio",
|
|
"bridge": "vmbr0",
|
|
"vlan_tag": "10",
|
|
"firewall": true
|
|
}
|
|
]
|
|
```
|
|
|
|
- `bridge` (string) - Required. Which Proxmox bridge to attach the
|
|
adapter to.
|
|
|
|
- `model` (string) - Model of the virtual network adapter. Can be
|
|
`rtl8139`, `ne2k_pci`, `e1000`, `pcnet`, `virtio`, `ne2k_isa`,
|
|
`i82551`, `i82557b`, `i82559er`, `vmxnet3`, `e1000-82540em`,
|
|
`e1000-82544gc` or `e1000-82545em`. Defaults to `e1000`.
|
|
|
|
- `mac_address` (string) - Give the adapter a specific MAC address. If
|
|
not set, defaults to a random MAC.
|
|
|
|
- `vlan_tag` (string) - If the adapter should tag packets. Defaults to
|
|
no tagging.
|
|
|
|
- `firewall` (bool) - If the interface should be protected by the firewall.
|
|
Defaults to `false`.
|
|
|
|
- `packet_queues` (int) - Number of packet queues to be used on the device.
|
|
Values greater than 1 indicate that the multiqueue feature is activated.
|
|
For best performance, set this to the number of cores available to the
|
|
virtual machine. CPU load on the host and guest systems will increase as
|
|
the traffic increases, so activate this option only when the VM has to
|
|
handle a great number of incoming connections, such as when the VM is
|
|
operating as a router, reverse proxy or a busy HTTP server. Requires
|
|
`virtio` network adapter. Defaults to `0`.
|
|
|
|
- `disks` (array of objects) - Disks attached to the virtual machine.
|
|
Example:
|
|
|
|
```json
|
|
[
|
|
{
|
|
"type": "scsi",
|
|
"disk_size": "5G",
|
|
"storage_pool": "local-lvm",
|
|
"storage_pool_type": "lvm"
|
|
}
|
|
]
|
|
```
|
|
|
|
- `storage_pool` (string) - Required. Name of the Proxmox storage pool
|
|
to store the virtual machine disk on. A `local-lvm` pool is allocated
|
|
by the installer, for example.
|
|
|
|
- `storage_pool_type` (string) - Required. The type of the pool, can
|
|
be `lvm`, `lvm-thin`, `zfspool`, `cephfs`, `rbd` or `directory`.
|
|
|
|
- `type` (string) - The type of disk. Can be `scsi`, `sata`, `virtio` or
|
|
`ide`. Defaults to `scsi`.
|
|
|
|
- `disk_size` (string) - The size of the disk, including a unit suffix, such
|
|
as `10G` to indicate 10 gigabytes.
|
|
|
|
- `cache_mode` (string) - How to cache operations to the disk. Can be
|
|
`none`, `writethrough`, `writeback`, `unsafe` or `directsync`.
|
|
Defaults to `none`.
|
|
|
|
- `format` (string) - The format of the file backing the disk. Can be
|
|
`raw`, `cow`, `qcow`, `qed`, `qcow2`, `vmdk` or `cloop`. Defaults to
|
|
`raw`.
|
|
|
|
- `template_name` (string) - Name of the template. Defaults to the generated
|
|
name used during creation.
|
|
|
|
- `template_description` (string) - Description of the template, visible in
|
|
the Proxmox interface.
|
|
|
|
- `onboot` (boolean) - Specifies whether a VM will be started during system
|
|
bootup. Defaults to `false`.
|
|
|
|
- `disable_kvm` (boolean) - Disables KVM hardware virtualization. Defaults to `false`.
|
|
|
|
- `scsi_controller` (string) - The SCSI controller model to emulate. Can be `lsi`,
|
|
`lsi53c810`, `virtio-scsi-pci`, `virtio-scsi-single`, `megasas`, or `pvscsi`.
|
|
Defaults to `lsi`.
|
|
|
|
- `full_clone` (bool) - Whether to run a full or shallow clone from the base clone_vm. Defaults to `true`.
|
|
|
|
- `boot` - (string) - Override default boot order. Format example `order=virtio0;ide2;net0`.
|
|
Prior to Proxmox 6.2-15 the format was `cdn` (c:CDROM -> d:Disk -> n:Network)
|
|
|
|
## Example: Cloud-Init enabled Debian
|
|
|
|
Here is a basic example creating a Debian 10 server image. This assumes
|
|
that there exists a Cloud-Init enabled image on the Proxmox server named
|
|
`debian-10-4`.
|
|
|
|
```json
|
|
{
|
|
"variables": {
|
|
"proxmox_url": "{{env `PROXMOX_URL`}}",
|
|
"proxmox_username": "{{env `PROXMOX_USERNAME`}}",
|
|
"proxmox_password": "{{env `PROXMOX_PASSWORD`}}"
|
|
},
|
|
|
|
"builders": [
|
|
{
|
|
"type": "proxmox-clone",
|
|
"proxmox_url": "{{user `proxmox_url`}}",
|
|
"username": "{{user `proxmox_username`}}",
|
|
"password": "{{user `proxmox_password`}}",
|
|
"node": "pve",
|
|
"insecure_skip_tls_verify": true,
|
|
"clone_vm": "debian-10-4",
|
|
"template_name": "debian-scaffolding",
|
|
"template_description": "image made from cloud-init image",
|
|
|
|
"pool": "api-users",
|
|
"os": "l26",
|
|
"cores": 1,
|
|
"sockets": 1,
|
|
"memory": 2048,
|
|
"network_adapters": [
|
|
{
|
|
"bridge": "vmbr0"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"description": "A template for building a base"
|
|
}
|
|
```
|