26 lines
504 B
Bash
26 lines
504 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
HOSTS="$1"
|
||
|
|
||
|
case $HOSTS in
|
||
|
*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="play-$(tr -dc A-Za-z < /dev/urandom | head -c 10).yml"
|
||
|
envsubst < playbook_template.yml > "$PLAYBOOK"
|
||
|
ansible-playbook "$PLAYBOOK" --ask-become-pass --ask-vault-pass
|
||
|
STATUS=$?
|
||
|
|
||
|
rm -f "$PLAYBOOK"
|
||
|
exit $STATUS
|