Denis Machard

My technical gists

Infrastructure background, developer mindset. I build things for pleasure.
    @github @mastodon @rss

    Building a cloud-init template with Almalinux8 on Proxmox

    How to build a cloud-init template with Almalinux8

    Prerequisites

    Connect on your proxmox server and export the following variables

    export CI_IMAGE="AlmaLinux-8-GenericCloud-latest.x86_64.qcow2"
    
    export PM_STORAGE="local-lvm"
    
    export VM_NAME="almalinux-8-cloudinit-template"
    export VM_ID=1000
    export VM_MEM=1024
    export VM_OPTS=-"-net0 virtio,bridge=vmbr1"
    

    Build

    Download a pre-configured image from AlmaLinux’s official repositories.

    wget https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/$CI_IMAGE
    

    Create empty VM

    qm create $VM_ID --name $VM_NAME --memory $VM_MEM $VM_OPTS
    

    Import the downloaded image to the VM

    $ qm importdisk $VM_ID $CI_IMAGE $PM_STORAGE
    

    Assign the imported disk to scsi0

    $ qm set $VM_ID -scsihw virtio-scsi-pci -scsi0 $PM_STORAGE:vm-$VM_ID-disk-0
    

    Add special IDE device for cloud-init :

    $ qm set $VM_ID --ide2 $PM_STORAGE:cloudinit
    

    Set it as the boot disk

    $ qm set $VM_ID --boot c --bootdisk scsi0
    

    VGA interface for console

    $ qm set $VM_ID --serial0 socket --vga serial0
    

    Convert to template:

    $ qm template $VM_ID
    
    propulsed by hugo and hugo-theme-gists