summaryrefslogtreecommitdiff
path: root/apply-role.sh
blob: a2b0ac4f1601b32edf15ada9f2e903b79074bb1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash

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' in environment '$env' ########"
exec ansible-playbook -e "myhosts=$hosts" -e "myrole=$role" $@ "$env/generic.yaml"