Shell Script tools to create/delete VM cloud-init in Proxmox Virtual Environment (PVE) like proxmox-cloud-init-tools, but more complex.
Login on your Proxmox VE server over SSH or Console Shell Clone pvecikas (proxmox cloud-init) project
git clone https://github.com/mcdir/pvecikas/
cd pvecikas
# Prepare
sudo apt-get install pytho3-jinja2 -y
#
cd ./.utils
cp ./.env-example.yml ./.env.yml
# example for ubuntu
cd ..
cd ubuntu/jammy-22.04/
./init.sh
nano ./.envs/.env_local.sh
# update next variables or keep it as it is:
# export PV_STORAGE_ID="local-lvm"
# export PV_STORAGE_TYPE="lvm"
update .env.yml with you variables, like pub ssh key, default user password, etc. and run next:
bash ./re-build.sh
There are many automation tools, but for a number of reasons they are not suitable for quickly creating and deleting a large number of virtual machines (VM) configured to work in specific environments.
For example, to create a hypothetical cluster, you usually need:
- internal self-signed certificates;
- registered ssh keys on the VM;
- certain pre-installed software;
- certain VM network settings;
- conveniently change the VM disk size.
This set of cli utilities is based on:
- cloud-init images;
- virt-customize;
- api and cli proxmox;
- everyone's favorite bash ;)
The project allows you to:
- create/delete virtual machines in the proxmox environment;
- prepare cloud-init images before creating virtual machines based on them in the proxmox environment;
- create cloud-init templates.
- .utils: virtual machine configuration templates
- prepare-os.sh - prepare proxmox os for next step
- prepare-pve.sh — copy cloud-init templates to proxmox environment
- prepare-virt-customize.sh — prepare VM using virt-customize
- qm-clone-vm.sh - clone vm via qm and env
- qm-create-vm.sh - create vm via qm and env
- qm-destroy-vm.sh - destroy vm via qm and env
- qm-stop-vm.sh - stop vm via qm and env
- Auto cloud images download
- Debian 9 - Stretch
- Debian 10 - Buster
- Debian 11 - Bullseye 11
- Ubuntu Server 18.04 LTS - Bionic
- Ubuntu Server 20.04 LTS - Focal
- Ubuntu Server 22.04 LTS - Jammy
- Ubuntu Server 24.04 LTS - Noble
- Set VM Hostname
- Set VM Description
- Memory (any, via params)
- CPU Cores - @todo
- CPU Sockets - @todo
- Storage destination (Local, NFS, LVM/LVM-Thin, etc)
- Define and custom users.
- Insert SSH authorized keys to users;
- Select bridge network;
- Select Static/IP or DHCP usage;
- Define uniq VMID;
- Can start or not, VM after deployment.