it-wiki:proxmox:templating_cloudinit_deploy_vm
Deploy VM use Cloud Init Templates in Proxmox VE
Um aus einem Cloud Init Template eine angepasste VM zu erstellen muss natürlich als erstes ein VM Template entsprechend erstellt werden.
#!/bin/bash # Set the VM ID to operate on VMID=900 # Set a variable for our new VM ID NEW_VMID=500 NEW_VM_NAME=env-debian12 qm clone $VMID $NEW_VMID --name $NEW_VM_NAME --full --pool Test # Show Current configs qm config $NEW_VMID # Allocate 2GB of RAM qm set $NEW_VMID --memory 2048 # Allocate 2 vCPU Cores qm set $NEW_VMID --cores 2 # Resize bootdisk ## Get bootdisk interface NEW_VM_BOOTDISK_INTERFACE=$(qm config $NEW_VMID | grep bootdisk | awk '{print $2}') ## Resize bootdisk to 30GB qm disk resize $NEW_VMID $NEW_VM_BOOTDISK_INTERFACE 30G # Set Network config ## Static qm set $NEW_VMID --ipconfig0 ip=10.6.6.250/24,gw=10.6.6.1 ## DHCP # qm set $NEW_VMID --ipconfig0 ip=dhcp # Set Nameserver und Domain qm set $NEW_VMID --nameserver 10.6.6.1 qm set $NEW_VMID --searchdomain tuxnet.lan # Set Username qm set $NEW_VMID --ciuser ansible # Setup public SSH keys (one key per line, OpenSSH format). qm set $NEW_VMID --sshkeys ~/vm_sshkeys/keylist # First Start to run Ansible Playbooks qm start $NEW_VMID
it-wiki/proxmox/templating_cloudinit_deploy_vm.txt · Zuletzt geändert: 2025/01/29 16:42 von marko