28 lines
496 B
Bash
Executable file
28 lines
496 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
HOSTS="$1"
|
|
|
|
case $HOSTS in
|
|
*:*)
|
|
ROLES="['virt-common']" ;;
|
|
*app*)
|
|
ROLES="['virt-common', 'docker', 'apps']" ;;
|
|
*db*)
|
|
ROLES="['virt-common', 'postgresql']" ;;
|
|
*prx*|proxy*)
|
|
ROLES="['virt-common', 'docker', 'proxy']" ;;
|
|
*)
|
|
ROLES="['virt-common']" ;;
|
|
esac
|
|
|
|
export HOSTS
|
|
export ROLES
|
|
|
|
PLAYBOOK="playbook-$(tr -dc A-Za-z < /dev/urandom | head -c 10).yml"
|
|
envsubst < site.yml > "$PLAYBOOK"
|
|
ansible-playbook "$PLAYBOOK"
|
|
STATUS=$?
|
|
|
|
rm -f "$PLAYBOOK"
|
|
exit $STATUS
|