++viirb cleanup

This commit is contained in:
Nico Schottelius 2020-06-14 22:54:40 +02:00
parent d54b383e44
commit c803679610
2 changed files with 16 additions and 4 deletions

View file

@ -5,9 +5,23 @@
set -e
set -x
if [ $# -ne 2 ]; then
echo "$0 viirb-ip-address viirb-id"
echo " viirb-ip-address: where to find the viirb"
echo " viirb-id: number in decimal format"
exit 1
fi
viirb_ip=$1; shift
id=$1; shift
viirb_hostname=viirb${id}
root_password=$(pwgen -1 32)
# Save for sending to user
# FIXME: future make this more easy / better to transfer
echo $root_password > ${viirb_hostname}.rootpw
cat <<EOF | ssh -t "root@${viirb_ip}"
# Remove temporary IP
@ -25,5 +39,3 @@ printf "${root_password}\n${root_password}\n" | passwd
EOF
echo "Submit to user the root password = ${root_password}"
}

View file

@ -16,7 +16,7 @@ public_key=$1; shift
dot_cdist=$1; shift
hex_id=$(printf "%0.2x\n" "$id")
viirb_hostname=viirb${hex_id}
viirb_hostname=viirb${id}
prefix_base=2a0a:e5c1:3
my_prefix=${prefix_base}${hex_id}