Cloud-Init Support

From Proxmox VE
Jump to: navigation, search






Preparing Cloud-Init Templates


apt-get install cloud-init


# download the image

# create a new VM

# import the downloaded disk to local-lvm storage

# finally attach the new disk to the VM as scsi drive
Note Ubuntu Cloud-Init images require the virtio-scsi-pci controller type for SCSI drives.
Add Cloud-Init CDROM drive


qm set 9000 --ide2 local-lvm:cloudinit


qm set 9000 --boot c --bootdisk scsi0


qm set 9000 --serial0 socket --vga serial0


qm template 9000

Deploying Cloud-Init Templates


You can easily deploy such a template by cloning:

qm clone 9000 123 --name ubuntu2


qm set 123 --sshkey ~/.ssh/
qm set 123 --ipconfig0 ip=,gw=

You can also configure all the Cloud-Init options using a single command only. We have simply splitted the above example to separate the commands for reducing the line length. Also make sure to adopt the IP setup for your specific environment.

Cloud-Init specific Options

cicustom: [meta=<volume>] [,network=<volume>] [,user=<volume>]

Specify custom files to replace the automatically generated ones at start.


Specify a custom file containing all meta data passed to the VM via cloud-init. This is provider specific meaning configdrive2 and nocloud differ.


Specify a custom file containing all network data passed to the VM via cloud-init.


Specify a custom file containing all user data passed to the VM via cloud-init.

cipassword: <string>

Password to assign the user. Using this is generally not recommended. Use ssh keys instead. Also note that older cloud-init versions do not support hashed passwords.

citype: <configdrive2 | nocloud>

Specifies the cloud-init configuration format. The default depends on the configured operating system type (ostype. We use the nocloud format for Linux, and configdrive2 for windows.

ciuser: <string>

User name to change ssh keys and password for instead of the image’s configured default user.

ipconfig[n]: [gw=<GatewayIPv4>] [,gw6=<GatewayIPv6>] [,ip=<IPv4Format/CIDR>] [,ip6=<IPv6Format/CIDR>]

Specify IP addresses and gateways for the corresponding interface.

IP addresses use CIDR notation, gateways are optional but need an IP of the same type specified.

The special string dhcp can be used for IP addresses to use DHCP, in which case no explicit gateway should be provided. For IPv6 the special string auto can be used to use stateless autoconfiguration.

If cloud-init is enabled and neither an IPv4 nor an IPv6 address is specified, it defaults to using dhcp on IPv4.


Default gateway for IPv4 traffic.

Note Requires option(s): ip

Default gateway for IPv6 traffic.

Note Requires option(s): ip6
ip=<IPv4Format/CIDR> (default = dhcp)

IPv4 address in CIDR format.

ip6=<IPv6Format/CIDR> (default = dhcp)

IPv6 address in CIDR format.

nameserver: <string>

Sets DNS server IP address for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.

searchdomain: <string>

Sets DNS search domains for a container. Create will automatically use the setting from the host if neither searchdomain nor nameserver are set.

sshkeys: <string>

Setup public SSH keys (one key per line, OpenSSH format).