Skip to content

Instantly share code, notes, and snippets.

@hkumarmk
Created December 11, 2014 09:18
Show Gist options
  • Select an option

  • Save hkumarmk/fc5289aa606fa6302327 to your computer and use it in GitHub Desktop.

Select an option

Save hkumarmk/fc5289aa606fa6302327 to your computer and use it in GitHub Desktop.
vagrant parallel provision
#!/bin/bash
#
# Parallel provisioning for vagrant
#
up() {
vagrant up --no-provision
}
provision() {
sleep 5
. newtokens.sh
for i in `vagrant status | grep running | awk '{print $1}'`; do
vagrant provision $i | tee $logdir/provision_${i}.log &
done
}
destroy() {
vagrant destroy -f
}
logdir="`pwd`/logs"
if [ ! -d $logdir ]; then
mkdir -p $logdir
fi
case $1 in
'destroy')
destroy
;;
'up')
up
provision
;;
'provision')
provision
;;
'reset')
destroy
up
provision
;;
*)
echo "Invalid operation. Valid operations are destroy, up, provision,reset"
exit 100
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment