#!/bin/bash set -exu cd "$(dirname "$0")" # see https://www.sovereign-stack.org/management/ . ./defaults.sh # the DISK variable here tells us which disk (partition) the admin wants to use for # lxd resources. By default, we provision the disk under / as a loop device. Admin # can override with CLI modifications. DISK="rpool/lxd" #DISK="/dev/sda1" export DISK="$DISK" # let's check to ensure the management machine is on the Baseline ubuntu 21.04 if ! lsb_release -d | grep -q "Ubuntu 22.04"; then echo "ERROR: Your machine is not running the Ubuntu 22.04 LTS baseline OS on your management machine." exit 1 fi # install snap if ! snap list | grep -q lxd; then sudo snap install lxd sleep 3 # run lxd init on the remote server./dev/nvme1n1 # cat <> "$HOME/.bashrc" ADDED_COMMAND=true fi wait-for-it -t 300 "$IP_V4_ADDRESS:22" > /dev/null 2>&1 # Let's remove any entry in our known_hosts, then add it back. # we are using IP address here so we don't have to rely on external DNS # configuration for the base image preparataion. ssh-keygen -R "$IP_V4_ADDRESS" ssh-keyscan -H -t ecdsa "$IP_V4_ADDRESS" >> "$SSH_HOME/known_hosts" ssh "ubuntu@$IP_V4_ADDRESS" sudo chown -R ubuntu:ubuntu /home/ubuntu ssh "ubuntu@$IP_V4_ADDRESS" /home/ubuntu/sovereign-stack/management/provision.sh lxc restart ss-mgmt if [ "$ADDED_COMMAND" = true ]; then echo "NOTICE! You need to run 'source ~/.bashrc' before continuing. After that, type 'ss-manage' to enter your management environment." fi