diff options
Diffstat (limited to 'apply-role.sh')
-rwxr-xr-x | apply-role.sh | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apply-role.sh b/apply-role.sh index 3d39f345..708a8357 100755 --- a/apply-role.sh +++ b/apply-role.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ -z "$1" ] || [ -z "$2" ] ; then +if [ -z "$1" ] || [ -z "$2" ]; then echo "$0 <host(s)> <role>" exit 1 fi @@ -9,5 +9,10 @@ shift role="$1" shift -echo "######## applying the role '$role' to host(s) '$hosts' ########" -exec ansible-playbook -e "myhosts=$hosts" -e "myrole=$role" $@ generic.yaml +cd "${BASH_SOURCE%/*}" +source common/utils.sh +ansible_variable__get env_group "$hosts" || exit 1 +vault_environment__set "$env_group" || exit 1 + +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" |