#!/bin/bash

# Arguments
inventory="$1"
if [ "$inventory" == "-h" ] || [ "$inventory" == "--help" ]; then
    echo "Usage: $0 -h # Usage"
    echo "       $0    # Run a complete deployment."
    exit 0
elif [ -z "$inventory" ]; then
    inventory="examples/msn0.yml"
fi

# Find the root of the git clone
while [ ! -d .git ]; do
    cd ..
    if [ "$PWD" == '/' ]; then
        echo "This needs to be run from the Ubiqtorate checkout"
        exit 3
    fi
done

ansible-playbook -i examples/msn0.yml playbooks/deploy.yml