#!/bin/bash
target=ansible
inventory=
ARGS=
while getopts ":i:, :h, :t:" opt; do
  case $opt in
    h)
      echo "USAGE: ansible-deploy [any ansible-playbook arguments]"
      exit
      ;;
    t)
    target=$OPTARG
      ;;

    i)
    inventory=$OPTARG
      ;;

    \?)
      ARGS+="$ARGS $OPTARG"
      echo $ARGS $OPTARG $opt
      ;;
  esac
done

OLD=$(pwd)
if [[ ! -e ~/.ansible-deploy ]]; then
  git clone https://github.com/moshloop/ansible-deploy.git ~/.ansible-deploy
fi
cd $OLD

ansible-playbook ~/.ansible-deploy/deploy.yml $@
