2023-02-01 19:44:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-03-05 16:50:22 +00:00
|
|
|
set -e
|
2023-02-01 19:44:05 +00:00
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
|
|
# NOTE! This script MUST be executed as root.
|
|
|
|
sudo apt-get update
|
2023-08-12 16:25:23 +00:00
|
|
|
sudo apt-get install -y ca-certificates curl gnupg lsb-release jq bc
|
2023-02-01 19:44:05 +00:00
|
|
|
|
2023-03-15 23:19:32 +00:00
|
|
|
sudo mkdir -m 0755 -p /etc/apt/keyrings
|
2023-02-01 19:44:05 +00:00
|
|
|
|
|
|
|
# add the docker gpg key to keyring for docker-ce-cli
|
|
|
|
if [ ! -f /etc/apt/keyrings/docker.gpg ]; then
|
|
|
|
cat /home/ubuntu/sovereign-stack/certs/docker.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# TODO REVIEW mgmt software requirements
|
|
|
|
sudo apt-get update
|
2023-12-17 21:49:54 +00:00
|
|
|
sudo apt-get install -y wait-for-it dnsutils rsync sshfs apt-transport-https docker-ce-cli libcanberra-gtk-module nano git gridsite-clients
|
2023-02-01 19:44:05 +00:00
|
|
|
|
2023-11-29 19:04:24 +00:00
|
|
|
sudo bash -c "$HOME/sovereign-stack/install_incus.sh"
|
2023-02-01 19:44:05 +00:00
|
|
|
|
2023-11-29 19:04:24 +00:00
|
|
|
sudo incus admin init --minimal
|
2023-02-01 19:44:05 +00:00
|
|
|
|
2023-11-30 02:34:29 +00:00
|
|
|
# add docker group
|
2023-11-29 19:04:24 +00:00
|
|
|
if ! grep -q "^docker:" /etc/group; then
|
|
|
|
sudo groupadd docker
|
2023-02-01 19:44:05 +00:00
|
|
|
fi
|
|
|
|
|
2023-11-30 02:34:29 +00:00
|
|
|
# add incus-admin group
|
2023-11-29 19:04:24 +00:00
|
|
|
if ! grep -q "^incus-admin:" /etc/group; then
|
|
|
|
sudo groupadd incus-admin
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! groups ubuntu | grep -q "\bdocker\b"; then
|
2023-03-06 19:44:36 +00:00
|
|
|
sudo usermod -aG docker ubuntu
|
2023-11-29 19:04:24 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! groups ubuntu | grep -q "\bincus-admin\b"; then
|
|
|
|
sudo usermod -aG incus-admin ubuntu
|
2023-03-06 19:44:36 +00:00
|
|
|
fi
|