ungleich-tools/vm-create
Nico Schottelius c92dd70632 ++ changes
2019-01-20 17:32:48 +01:00

50 lines
1.9 KiB
Text

#!/bin/random
# This is a sample script / prototype to create VMs in Data Center
# Light
#
# Flow to register payment:
#
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to pay.ungleich.ch with (name, realm, token) { JSON }
# Json similar to:
#
# { type: "credit-card" cc number, name, verify, ... }
#
#
# Flow to add an ssh key:
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to infra.ungleich.ch/api using (name, realm, token) POST { json }
# { key: ... }
# Standard rest, registering it internally to a user
#
# Flow to create a VM:
#
# - Connect to account.ungleich.ch with (username, password) for getting (name, realm, seed)
# - Connect to infra.ungleich.ch/api using (name, realm, token) POST { json }
# - infra.ungleich.ch then connects to otp.ungleich.ch verifying the (name, realm, token)
# - infra.ungleich.ch checks that user has >= 1 ssh keys registered, otherwise gives error message
# - infra.ungleich.ch then connects to pay.ungleich.ch verifying that the user can "afford" the VM / books it
# infra passes (user, product, productvariant)
# --> infra needs to be able to derive a product from the parameters to pass to pay.ungleich.ch
# --> if user is not able to afford, return error to the user
# - pay.ungleich.ch stores the order / subscription (depending on the type)
# - Variant a)
# - infra.ungleich.ch returns { OK + ticket number }
# - client can poll / get the status of the VM on infra.ungleich.ch
# - Meanwhile infra.ungleich.ch then creates the VM/configures the VM/ensures the ssh key(s) are added
# - Variant b)
# - infra.ungleich.ch then creates the VM/configures the VM/ensures the ssh key(s) are added
#
#
#
#
if [ $# -ne 2 ]; then
echo "$0: username password template ssdsizegb ramgb cpunum hddsizegb onlyipv6"
exit 1
fi
curl https://