#!/bin/bash SERVER=$1 PLAYBOOK=$2 USER=$3 while [[ "$#" -gt 0 ]]; do case $1 in -f|--force) force=1; shift ;; esac shift done usage() { echo "Usage: run-vps-playbook.sh server playbook" echo "server - domain or ip address of the vps server" echo "playbook - playbook file" echo "[user] - if choose the use it, otherwise used root" } if [[ -z "$SERVER" ]]; then echo "You must defined SERVER as first argument" usage exit 1 fi if [[ -z "$PLAYBOOK" ]]; then echo "You must defined PLAYBOOK as second argument" usage exit 1 fi if [[ -z "$USER" ]]; then USER=root fi COMMAND=$(cat <