From 892a661dfc3a459c2cffa2221e5fbcf41ea43050 Mon Sep 17 00:00:00 2001 From: trigkeyb Date: Sat, 1 Feb 2025 09:54:43 +0100 Subject: [PATCH] primeras pruebas --- clonar/0.crea_VM.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 clonar/0.crea_VM.sh diff --git a/clonar/0.crea_VM.sh b/clonar/0.crea_VM.sh new file mode 100755 index 0000000..b462813 --- /dev/null +++ b/clonar/0.crea_VM.sh @@ -0,0 +1,32 @@ +# Crea variables +# ID de VM +VMID="919200" + +# lugar de almacenamiento para el disco +### VMSTORAGE="VMs_storage-E" +VMSTORAGE="local" + +# network +### VMNET="k8s" +VMNET="vmbr0" + +# hostname +VMHOST="k8scp" + +# Genera la configuracion inicial de CLoudInit +./genera_yaml_k8s.sh + +# apaga y borra la VM si existe antes +qm stop $VMID +qm destroy $VMID + +qm create $VMID --name $VMHOST --memory 8192 --cores 4 --net0 virtio,bridge=$VMNET --cpu host --agent enabled=1 --tags k8s +qm set $VMID --ide2 VMs_storage-E:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0 + +# qm importdisk $VMID /mnt/pve/ISOs_storage/template/iso/ubuntu-24.04-server-cloudimg-amd64.img VMs_storage-E --format qcow2 +qm importdisk $VMID /mnt/pve/ISOs_storage/template/iso/ubuntu-24.04-server-cloudimg-amd64.img local --format qcow2 +qm set $VMID --scsihw virtio-scsi-pci --scsi0 $VMSTORAGE:$VMID/vm-$VMID-disk-0.qcow2 +qm disk resize $VMID scsi0 40G +qm set $VMID --ipconfig0 ip=dhcp --cicustom "user=VMs_storage-E:snippets/user_data.yaml" + +qm start $VMID