#!/bin/bash SERVER=$1 LXC_HOST=$2 PLAYBOOK=$3 while [[ "$#" -gt 0 ]]; do case $1 in -f|--force) force=1; shift ;; esac shift done usage() { echo "Usage: run-lxc-playbook.sh server lxc_host playbook" echo "server - main proxmox server IP address and lxc_host that the name of lxc container" echo "lxc_host - name of lxc container" echo "playbook - playbook file" } if [[ -z "$SERVER" ]]; then echo "You must defined SERVER as first argument" usage exit 1 fi if [[ -z "$LXC_HOST" ]]; then echo "You must defined LXC_HOST as second argument" usage exit 1 fi if [[ -z "$PLAYBOOK" ]]; then echo "You must defined PLAYBOOK as third argument" usage exit 1 fi if [[ ! -f "$PLAYBOOK" ]]; then echo "Playbook file is not exists: $PLAYBOOK" usage exit 1 fi COMMAND=$(cat <