Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- set -x
- VM_ID=$1
- VM_NAME=$2
- VM_TAGS=$3
- VM_USER=$4
- VM_PASSWORD=$5
- VM_DOMAIN=$6
- VM_SSH_KEYS=$7
- VM_IMAGE=$8
- qm unlock $VM_ID || true
- qm destroy $VM_ID || true
- qm create $VM_ID \
- --name $VM_NAME \
- --tags $VM_TAGS \
- --memory 4096 \
- --cores 2 \
- --net0 virtio,bridge=vmbr1 \
- --scsihw virtio-scsi-pci \
- --ciuser $VM_USER \
- --cipassword $VM_PASSWORD \
- --searchdomain $VM_DOMAIN \
- --sshkeys $VM_SSH_KEYS \
- --ipconfig0 ip=dhcp \
- --ostype l26 \
- --agent 1
- virt-customize -a $VM_IMAGE --install qemu-guest-agent
- qm set $VM_ID --scsi0 vmdata:0,import-from=$VM_IMAGE --boot order=scsi0 --ide2 vmdata:cloudinit
- qm resize $VM_ID scsi0 8G
- qm template $VM_ID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement