Created
April 25, 2014 10:25
-
-
Save drucko/11284778 to your computer and use it in GitHub Desktop.
Massautoinstall KVM Guests with LVM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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