Skip to content

Instantly share code, notes, and snippets.

@megahall
Created October 21, 2015 01:52
Show Gist options
  • Save megahall/fa3ba7ba18cdb43c5a76 to your computer and use it in GitHub Desktop.
Save megahall/fa3ba7ba18cdb43c5a76 to your computer and use it in GitHub Desktop.
deploys OVA files onto ESXi with high performance
#!/bin/bash
set -e -x
images=$(ls some_directories/*.ova)
suffix="test_A"
for image in ${images}; do
image_name=$(basename "${image}" ".ova")
count=1
if [[ $image =~ something_that_uses_clustering ]]; then
count=2
fi
for ((i=0; $i < $count; ++i)); do
id=$(printf "%02d" "${count}")
name="${image_name}_${suffix}_${id}"
ovftool \
--lax \
--X:logFile=ovftool.log \
--X:logLevel=verbose \
--acceptAllEulas \
--compress=9 \
--diskMode=thick \
--ipAllocationPolicy=dhcpPolicy \
--fencedMode=bridged \
--powerOffSource \
--sourceType=OVA \
--name="${name}" \
--datastore=Speedy \
"${image}" \
vi://root:password@ESXI_IP_ADDRESS
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment