Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #23 from oxyc/extra_vars
Browse files Browse the repository at this point in the history
Add a flag for passing extra-vars on to ansible
  • Loading branch information
geerlingguy committed Mar 2, 2016
2 parents c2662ea + 5a3a80e commit e06186b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@
# Uncomment if behind a proxy server.
# export {http,https,ftp}_proxy='http://username:password@proxy-host:80'

args=()
extra_vars=("is_windows=true")

# Process and remove all flags.
while (($#)); do
case $1 in
--extra-vars=*) extra_vars+=("${1#*=}") ;;
--extra-vars|-e) shift; extra_vars+=("$1") ;;
-*) echo "invalid option: $1" >&2; exit 1 ;;
*) args+=("$1") ;;
esac
shift
done

# Restore the arguments without flags.
set -- "${args[@]}"

ANSIBLE_PLAYBOOK=$1
PLAYBOOK_DIR=${ANSIBLE_PLAYBOOK%/*}

Expand Down Expand Up @@ -63,4 +80,4 @@ find "/vagrant/$PLAYBOOK_DIR" \( -name "requirements.yml" -o -name "requirements

# Run the playbook.
echo "Running Ansible provisioner defined in Vagrantfile."
ansible-playbook -i 'localhost,' "/vagrant/${ANSIBLE_PLAYBOOK}" --extra-vars "is_windows=true" --connection=local
ansible-playbook -i 'localhost,' "/vagrant/${ANSIBLE_PLAYBOOK}" --extra-vars "${extra_vars[*]}" --connection=local

0 comments on commit e06186b

Please sign in to comment.