diff --git a/terraform/README.md b/terraform/README.md index 240fa4e71c60d7472679e8ba15cf7334c8fac58d..69a6519bdda91cf12e4cc26dde89f2da4a80bfb5 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -3,3 +3,30 @@ ```bash source ./secret/login.sh ``` + +# How to create Cloudinit template + +Download the ubuntu cloud image `img` file: https://cloud-images.ubuntu.com/ +(It should work with debian) + +Setup + +```bash +export STORAGE_POOL="ssd" +export VM_ID="10000" +export VM_NAME="ubuntu-cloudinit-20.04" +export CLOUD_IMG_FILE="focal-server-cloudimg-amd64.img" + +qm create $VM_ID -name $VM_NAME -memory 1024 -net0 virtio,bridge=vmbr0 -cores 1 -sockets 1 +qm importdisk $VM_ID $CLOUD_IMG_FILE $STORAGE_POOL +qm set $VM_ID -scsihw virtio-scsi-pci -virtio0 ssd:vm-$VM_ID-disk-0 +qm set $VM_ID -serial0 socket +qm set $VM_ID -boot c -bootdisk virtio0 +qm set $VM_ID -agent 1 +qm set $VM_ID -agent 1 +qm set $VM_ID -hotplug network,usb +qm set $VM_ID -vga qxl +qm set $VM_ID -ide2 ssd:cloudinit +qm resize $VM_ID virtio0 +4G +qm template $VM_ID +```