diff options
Diffstat (limited to 'apply-role.sh')
-rwxr-xr-x | apply-role.sh | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/apply-role.sh b/apply-role.sh index 3d39f345..a2b0ac4f 100755 --- a/apply-role.sh +++ b/apply-role.sh @@ -1,13 +1,15 @@ #!/bin/bash -if [ -z "$1" ] || [ -z "$2" ] ; then - echo "$0 <host(s)> <role>" +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ] ; then + echo "$0 <environment> <host(s)> <role>" exit 1 fi +env="$1" +shift hosts="$1" shift role="$1" shift -echo "######## applying the role '$role' to host(s) '$hosts' ########" -exec ansible-playbook -e "myhosts=$hosts" -e "myrole=$role" $@ generic.yaml +echo "######## applying the role '$role' to host(s) '$hosts' in environment '$env' ########" +exec ansible-playbook -e "myhosts=$hosts" -e "myrole=$role" $@ "$env/generic.yaml" |