#!/bin/bash

cd $(dirname $0)
TEMPFILE=$(mktemp || mktemp -t X) 2>/dev/null
EXTRA_VARS="tempfile=$TEMPFILE $*"
eval ansible-playbook -i hosts --extra-vars "\"$EXTRA_VARS\"" deploy.yml >&2
cat $TEMPFILE
rm -rf $TEMPFILE

#!/bin/bash

cd $(dirname $0)
TEMPFILE=$(mktemp || mktemp -t X) 2>/dev/null
for var in $*; do
    EXTRA_VARS="$EXTRA_VARS --extra-vars \"$var\"";
done
EXTRA_VARS="$EXTRA_VARS --extra-vars \"tempfile=$TEMPFILE\""
eval ansible-playbook -i hosts $EXTRA_VARS deploy.yml >&2
cat $TEMPFILE
rm -rf $TEMPFILE

Deploy can use a file of default variables
Deploy can use a file of default variables