configpolicy/deploy/db0.sh

39 lines
763 B
Bash

#!/bin/sh
# vim: set ts=4 :
if ! virsh list --all --name | grep -qF db0; then
./newvm.sh db0 \
--fedora 39 \
--memory 8192,currentMemory=2048 \
--vcpus 4 \
--no-console \
-- \
--disk pool=default,size=128,cache=none \
|| exit
sleep 15
fi
nameserver=$(
dig +short -t srv _ldap._tcp.pdc._msdcs.pyrocufflink.blue \
| awk '{print $4}'
) || exit
nsupdate -g <<EOF || exit
server ${nameserver%.}
delete postgresql.pyrocufflink.blue
add postgresql.pyrocufflink.blue 300 CNAME db0.pyrocufflink.blue.
send
EOF
ANSIBLE_HOST_KEY_CHECKING=false \
ansible-playbook \
-l db0.pyrocufflink.blue \
wait-for-host.yml \
bootstrap.yml \
datavol.yml \
pyrocufflink.yml \
postgresql.yml \
-u root \
-e ansible_host=db0.local \
-e @join.creds \
|| exit