it-wiki:proxmox:templating_cloudinit
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| it-wiki:proxmox:templating_cloudinit [2024/07/11 12:23] – angelegt marko | it-wiki:proxmox:templating_cloudinit [2025/01/29 16:43] (aktuell) – [Cloud Init Template erzeugen] marko | ||
|---|---|---|---|
| Zeile 42: | Zeile 42: | ||
| ===== Cloud Init Template erzeugen ===== | ===== Cloud Init Template erzeugen ===== | ||
| + | Erstellen eines Bash Scriptes | ||
| <code bash> | <code bash> | ||
| + | vim ~/ | ||
| + | </ | ||
| + | <code bash> | ||
| + | # Set the VM ID to operate on | ||
| + | VMID=900 | ||
| + | # Choose a name for the VM | ||
| + | TEMPLATE_NAME=Debian12CloudInit | ||
| + | # Choose the disk image to import | ||
| + | DISKIMAGE=debian-12-genericcloud-amd64.qcow2 | ||
| + | # Select Host disk | ||
| + | HOST_DISK=Data | ||
| + | |||
| + | # fetch cloud-init image | ||
| + | wget https:// | ||
| + | |||
| + | # Delete old template | ||
| + | qm destroy $VMID | ||
| + | # Create the VM | ||
| + | qm create $VMID --name $TEMPLATE_NAME --net0 virtio, | ||
| + | # Set the OSType to Linux Kernel 6.x | ||
| + | qm set $VMID --ostype l26 | ||
| + | # Import the disk | ||
| + | qm importdisk $VMID $DISKIMAGE $HOST_DISK | ||
| + | # Attach disk to scsi bus | ||
| + | qm set $VMID --scsihw virtio-scsi-pci --scsi0 $HOST_DISK: | ||
| + | # Set scsi disk as boot device | ||
| + | qm set $VMID --boot c --bootdisk scsi0 | ||
| + | # Create and attach cloudinit drive | ||
| + | qm set $VMID --ide2 $HOST_DISK: | ||
| + | # Set serial console, which is needed by OpenStack/ | ||
| + | qm set $VMID --serial0 socket --vga serial0 | ||
| + | # Enable Qemu Guest Agent | ||
| + | qm set $VMID --agent enabled=1 # optional but recommened | ||
| + | # Convert the VM into a template | ||
| + | qm template $VMID | ||
| + | </ | ||
| + | |||
| + | |||
| + | **Skript ausführen** | ||
| + | <code bash> | ||
| + | cd ~/tmp/ | ||
| + | ./ | ||
| </ | </ | ||
| + | [[templating_cloudinit_deploy_vm|Eine VM aus dem Cloudinit Template erstellen]]. | ||
it-wiki/proxmox/templating_cloudinit.1720700622.txt.gz · Zuletzt geändert: von marko