2023-12-23 14:25:57 +00:00
|
|
|
#!/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
|
|
|
|
|
2023-12-25 22:17:36 +00:00
|
|
|
PLAYBOOK="playbook-$(tr -dc A-Za-z < /dev/urandom | head -c 10).yml"
|
|
|
|
envsubst < site.yml > "$PLAYBOOK"
|
2023-12-23 17:05:10 +00:00
|
|
|
ansible-playbook "$PLAYBOOK"
|
2023-12-23 14:25:57 +00:00
|
|
|
STATUS=$?
|
|
|
|
|
|
|
|
rm -f "$PLAYBOOK"
|
|
|
|
exit $STATUS
|