diff options
author | ansible <ansible@exolobe2> | 2015-10-08 21:16:19 +0300 |
---|---|---|
committer | ansible <ansible@exolobe2> | 2015-10-08 21:16:19 +0300 |
commit | 0505986743df1ec93e9eda2f4c0e102350de7e8a (patch) | |
tree | e49260a9abcfa48c4c1d103b5c08963778baf0fc /create-vm | |
parent | 9a0bf1a425a77b85aa90d22f72a50dc15d709529 (diff) | |
download | ansibleness-0505986743df1ec93e9eda2f4c0e102350de7e8a.tar.gz |
Make create-vm, remove-vm read a config file
This allows me to run them on places other than my laptop.
Diffstat (limited to 'create-vm')
-rwxr-xr-x | create-vm | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -2,6 +2,7 @@ # # Create a new VM for liw. + set -eu @@ -24,8 +25,8 @@ fi name="$1" base="$2" -# Where are the base images? -imagedir="/big/base-images" +# Config variables. +. "$HOME/.config/ansibleness/vm.conf" # Does the base image exist? basepath="$imagedir/base-$base.img.xz" @@ -38,9 +39,6 @@ fi # How large are the (uncompressed) images? size="4G" -# What volume group should we use? -vg="exolobe1-vg" - # Create new LV. sudo lvcreate --name "$name" --size "$size" "$vg" lvpath="/dev/$vg/$name" @@ -64,7 +62,8 @@ virt-install --connect qemu:///system \ --noautoconsole # Get the MAC address. -mac="$(virsh dumpxml "$name" | sed -n "/<mac address=/s/^.*'\(.*\)'.*/\1/p")" +mac="$(virsh -c qemu:///system dumpxml "$name" | + sed -n "/<mac address=/s/^.*'\(.*\)'.*/\1/p")" # Get IP address related to the MAC address. Append that to /etc/hosts. leases=/var/lib/libvirt/dnsmasq/default.leases |