Skip to content
Snippets Groups Projects

Prepare Proxmox template from Cloud image

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Aljaž Srebrnič

    Small script to create a template from an image

    Edited
    templatize.sh 536 B
    #!/bin/bash
    
    set -e
    
    template_id=$1
    image=$2
    storage=local-lvm
    
    if [ -z $template_id ] || [ -z $image ]; then
    	echo "Usage: $0 <template_id> <image_file>"
    	exit 255
    fi
    
    qm create $template_id --memory 2048 --net0 virtio,bridge=vmbr0
    qm importdisk $template_id "$image" $storage
    qm set $template_id --scsihw virtio-scsi-pci --scsi0 $storage:vm-${template_id}-disk-0
    qm set $template_id  --ide2 $storage:cloudinit
    qm set $template_id  --boot c --bootdisk scsi0
    qm set $template_id  --serial0 socket --vga serial0
    qm template $template_id
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment