#!/bin/bash if [ -z "$1" ] || [ -z "$2" ]; then echo "$0 " exit 1 fi hosts="$1" shift role="$1" shift source "${BASH_SOURCE%/*}/common/utils.sh" get_ansible_variable env_group "$hosts" if [ $? -ne 0 ]; then exit 1 fi echo "######## applying the role '$role' to host(s) '$hosts' in environment '$env_group' ########" exec ansible-playbook -e "myhosts=$hosts" -e "myrole=$role" $@ "$env_group/generic.yaml"