push config to rx and wm1, create backup accounts

This commit is contained in:
mischa 2022-11-22 18:01:17 +01:00
parent 63cef41a73
commit 4ee4772e70
1 changed files with 13 additions and 3 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2019-2021 Mischa Peters <mischa @ openbsd.amsterdam> # Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
# #
# Permission to use, copy, modify, and distribute this software for any # Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above # purpose with or without fee is hereby granted, provided that the above
@ -38,6 +38,16 @@ else
chmod 600 ${VMS}/${1}.txt chmod 600 ${VMS}/${1}.txt
fi fi
if [[ "${SERVER}" == server* ]]; then
HOST="s${SERVER#server}"
elif [[ "${SERVER}" == mega* ]]; then
HOST="m${SERVER#mega}"
fi
openrsync -va --del /home/mischa/vms/ mischa@wm1.obsda.ms:vms/${HOST}/
ssh wm1.obsda.ms "doas ./create-user.pl ${HOST}${1}"
openrsync -va --del /home/mischa/vms/ mischa@rx.high5.nl:vms/${HOST}/
deploy.pl deploy.pl
rcctl restart dhcpd rcctl restart dhcpd
vmctl reload vmctl reload
@ -47,7 +57,7 @@ auto-deploy.exp ${1}
if [ $? != 0 ]; then if [ $? != 0 ]; then
vmctl stop -f ${1} vmctl stop -f ${1}
rm -rf /var/vmm/${1}.qcow2 rm -rf /var/vmm/${1}.qcow2
pushover.pl -m "$(hostname -s) ${1} failed deploy" -p 1 pushover.pl -m "$(SERVER) ${1} failed deploy" -p 1
exit 1 exit 1
else else
vmctl stop -f ${1} vmctl stop -f ${1}
@ -63,5 +73,5 @@ if [ $? ]; then
echo echo
echo "SUCCES! - deployed ${1}" echo "SUCCES! - deployed ${1}"
notify.pl deployed ${1} notify.pl deployed ${1}
pushover.pl -m "$(hostname -s) ${1} deployed" -t "OpenBSD Amsterdam" pushover.pl -m "$(SERVER) ${1} deployed" -t "OpenBSD Amsterdam"
fi fi