Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate default user selection and OS evaluation #16

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions a-seed-from-nothing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
# Reset SECONDS
SECONDS=0

# Cloud User: cloud-user (CentOS) or ubuntu?
CLOUD_USER=ubuntu

ENABLE_OVN=true

# Registry IP
Expand All @@ -14,8 +11,7 @@ registry_ip=$1
echo "[INFO] Given docker registry IP: $registry_ip"

# Disable the firewall.
if [[ "${CLOUD_USER}" = "ubuntu" ]]
then
if type apt; then
grep -q $HOSTNAME /etc/hosts || (echo "$(ip r | grep -o '^default via.*src [0-9.]*' | awk '{print $NF}') $HOSTNAME" | sudo tee -a /etc/hosts)
dpkg -l ufw && sudo systemctl is-enabled ufw && sudo systemctl stop ufw && sudo systemctl disable ufw
else
Expand All @@ -26,8 +22,7 @@ else
fi

# Useful packages
if [[ "${CLOUD_USER}" = "ubuntu" ]]
then
if type apt; then
# Avoid the interactive dialog prompting for service restart: set policy to leave services unchanged
echo "\$nrconf{restart} = 'l';" | sudo tee /etc/needrestart/conf.d/90-aufn.conf
sudo apt update
Expand All @@ -45,8 +40,7 @@ EOF
sudo sysctl --load /etc/sysctl.d/70-ipv6.conf

# CentOS Stream 8 requires network-scripts. Rocky Linux 9 and onwards use NetworkManager.
if [[ "${CLOUD_USER}" = "cloud-user" ]]
then
if type dnf; then
case $(grep -o "[89]\.[0-9]" /etc/redhat-release) in
"8.*")
sudo dnf install -y network-scripts
Expand All @@ -63,8 +57,7 @@ then
exit -1
;;
esac
elif [[ "${CLOUD_USER}" = "ubuntu" ]]
then
elif type apt; then
# Prepare for disabling of Netplan and enabling of systemd-networkd.
# Netplan has an interaction with systemd and cloud-init to populate
# systemd-networkd files, but ephemerally. If /etc/systemd/network is
Expand All @@ -84,6 +77,7 @@ fi
set -e

# Ensure an ssh key is generated
CLOUD_USER=$(ls /home | grep -v lab | grep -v stack | head -1)
markgoddard marked this conversation as resolved.
Show resolved Hide resolved
# NOTE: you might think ~${CLOUD_USER} would work but apparently not
CLOUD_USER_DIR=/home/${CLOUD_USER}
keyfile="$HOME/.ssh/id_rsa"
Expand Down
9 changes: 2 additions & 7 deletions pull-retag-push-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ set -e
# Reset SECONDS
SECONDS=0

# DISTRO: CentOS or Ubuntu?
DISTRO=ubuntu

if [[ "${DISTRO}" = "ubuntu" ]]
then
if type apt; then
# Install and start docker
[[ -f /usr/share/keyrings/docker-archive-keyring.gpg ]] || (curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg)
echo \
Expand Down Expand Up @@ -43,8 +39,7 @@ fi

registry=quay.io
acct=openstack.kolla
if [[ "${DISTRO}" = "ubuntu" ]]
then
if type apt; then
tag=${1:-2023.1-ubuntu-jammy}
else
tag=${1:-2023.1-rocky-9}
Expand Down