Skip to content

Instantly share code, notes, and snippets.

@drucko
Created April 25, 2014 10:25
Show Gist options
  • Save drucko/11284778 to your computer and use it in GitHub Desktop.
Save drucko/11284778 to your computer and use it in GitHub Desktop.
Massautoinstall KVM Guests with LVM
#!/bin/bash
set -x
function createVolume {
lvmname=$1
echo "creating LVM $lvmname"
lvcreate -n $lvmname -L20G vg0
}
function installSystem {
systemname=$1
virt-install \
--connect qemu:///system \
--name $systemname \
--ram 128 \
--vcpus 1 \
--virt-type kvm \
--disk path=/dev/vg0/$systemname \
--os-type=linux \
--os-variant=debianwheezy \
--graphics vnc \
--network bridge=br0 \
--location http://http.debian.net/debian/dists/stable/main/installer-amd64 \
--extra-args "auto=true hostname=${systemname} domain=system url=http://subsole.org/static/misc/debian-preseed.cfg text"
}
for host in `cat hosts.cfg`
do
host_name=${host,,}
echo "create ${host_name}"
#createVolume $host_name
echo "install systems"
installSystem $host_name
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment