summaryrefslogtreecommitdiff
path: root/apply-role.sh
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2018-12-09 01:53:23 +0100
committerChristian Pointner <equinox@spreadspace.org>2018-12-09 01:53:23 +0100
commit755a54f2233e2aa9a27d3ab018879f7efbe8c501 (patch)
tree5d61aaafac00352b99a52dc20e13ba3fd7a35f34 /apply-role.sh
parentfixed acmetool self-signed cert handling (diff)
parentvm installation works now again (diff)
Merge branch 'new-repo-structure'
Diffstat (limited to 'apply-role.sh')
-rwxr-xr-xapply-role.sh11
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"