Created
December 11, 2014 09:18
-
-
Save hkumarmk/fc5289aa606fa6302327 to your computer and use it in GitHub Desktop.
vagrant parallel provision
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 | |
| # | |
| # 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