14
This commit is contained in:
parent
ecacd569ea
commit
beaad087bd
4
Makefile
4
Makefile
@ -8,3 +8,7 @@ deploy-nfs-config:
|
||||
|
||||
destroy-multinode:
|
||||
kolla-ansible destroy -i /opt/ansible-kolla/multinode --yes-i-really-really-mean-it
|
||||
|
||||
install-aio:
|
||||
bash install-docker.sh
|
||||
bash install-all-in-one.sh
|
||||
|
||||
20
clean-vm.sh
Normal file
20
clean-vm.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Stop and remove all running containers
|
||||
docker ps -aq | xargs docker rm -f
|
||||
|
||||
# Remove the venv and working dir
|
||||
rm -rf /opt/ansible-kolla-venv /opt/ansible-kolla
|
||||
|
||||
# Remove Kolla config
|
||||
rm -rf /etc/kolla
|
||||
|
||||
# Remove any leftover Docker volumes (Kolla uses Docker)
|
||||
docker volume prune -f
|
||||
|
||||
# Remove Kolla Docker images if you want a full clean
|
||||
docker images | grep kolla | awk '{print $3}' | xargs docker rmi -f
|
||||
|
||||
# Remove Docker itself if you want to go all the way
|
||||
dnf remove -y docker-ce docker-ce-cli containerd.io
|
||||
rm -rf /var/lib/docker
|
||||
7
cleanup-aio.sh
Normal file
7
cleanup-aio.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
source /opt/ansible-kolla-venv/bin/activate
|
||||
cd /opt/ansible-kolla
|
||||
|
||||
# Destroys all containers and volumes Kolla created
|
||||
kolla-ansible destroy -i ./all-in-one --yes-i-really-really-mean-it
|
||||
@ -1,24 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xe # Added -e to stop execution if a command fails
|
||||
|
||||
set -xe
|
||||
|
||||
# Defaults
|
||||
FIRST_INTERFACE="$(head -1 vars/aio/eth0)"
|
||||
|
||||
# enentually will be physnet1 in open stack networks
|
||||
EXTERNAL_INTERFACE="$(head -1 vars/aio/eth2)"
|
||||
|
||||
|
||||
# this should not be pingable in the installtion
|
||||
INTERNAL_IP="$(head -1 vars/aio/eth0-floating-ip)"
|
||||
|
||||
echo "--- Running Pre-flight Checks ---"
|
||||
|
||||
# 1. Check if the user is root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "ERROR: This script must be run as root (use sudo)."
|
||||
exit 1
|
||||
echo "ERROR: This script must be run as root (use sudo)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. Check if the network interfaces actually exist
|
||||
@ -38,9 +32,10 @@ if ping -c 1 -W 1 "$INTERNAL_IP" > /dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
# 4. Check for enough RAM (Kolla-Ansible usually needs 8GB+ for All-in-One)
|
||||
TOTAL_RAM=$(free -g | awk '/^Mem:/{print $2}')
|
||||
if [ "$TOTAL_RAM" -lt 8 ]; then
|
||||
echo "WARNING: You only have ${TOTAL_RAM}GB of RAM. OpenStack might be very slow or fail to deploy."
|
||||
# Use -m (MB) to avoid rounding errors from -g
|
||||
TOTAL_RAM_MB=$(free -m | awk '/^Mem:/{print $2}')
|
||||
if [ "$TOTAL_RAM_MB" -lt 8192 ]; then
|
||||
echo "WARNING: You only have ~$((TOTAL_RAM_MB / 1024))GB of RAM. OpenStack might be very slow or fail to deploy."
|
||||
fi
|
||||
|
||||
echo "--- Pre-flight Checks Passed! Starting Installation ---"
|
||||
@ -62,97 +57,79 @@ pip install -U pip
|
||||
pip install git+https://opendev.org/openstack/kolla-ansible@stable/2025.2
|
||||
|
||||
# 3. Configuration Setup
|
||||
cp -r ${KOLLA_VENV}/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
|
||||
cp -r "${KOLLA_VENV}/share/kolla-ansible/etc_examples/kolla/"* /etc/kolla/
|
||||
|
||||
# Change into working dir — all relative paths below are relative to here
|
||||
cd "${KOLLA_WORKING}"
|
||||
stat all-in-one || cp ${KOLLA_VENV}/share/kolla-ansible/ansible/inventory/all-in-one .
|
||||
[ ! -f all-in-one ] && cp "${KOLLA_VENV}/share/kolla-ansible/ansible/inventory/all-in-one" .
|
||||
|
||||
echo "take your time to setup the config files, then press enter..."
|
||||
read
|
||||
echo "Take your time to set up the config files, then press Enter to continue..."
|
||||
read -r
|
||||
|
||||
# Install Ansible and Galaxy roles
|
||||
# Install Ansible Galaxy roles and generate passwords
|
||||
kolla-ansible install-deps
|
||||
kolla-genpwd
|
||||
|
||||
# 4. Patch globals.yml
|
||||
GLOBALS_FILENAME="/etc/kolla/globals.yml"
|
||||
|
||||
# Only uncomments lines that start with '#option:'; will NOT override already-active 'no' values.
|
||||
enable_kolla_options() {
|
||||
local globals_file="$1"
|
||||
shift # Remove the first argument, leaving only the option names
|
||||
shift
|
||||
local options=("$@")
|
||||
|
||||
for option in "${options[@]}"; do
|
||||
echo "Enabling ${option}..."
|
||||
# This regex looks for lines starting with #option: and replaces
|
||||
# the entire line with the enabled version.
|
||||
sed -i "s@^#${option}:.*@${option}: \"yes\"@g" "${globals_file}"
|
||||
done
|
||||
}
|
||||
|
||||
#openstack_release: "master"
|
||||
sed -i "s@^#openstack_release:.*@openstack_release: \"2025.2\"@g" "${GLOBALS_FILENAME}"
|
||||
|
||||
# Note: Using @ as delimiter to avoid issues with potential paths
|
||||
sed -i "s@^#kolla_base_distro:.*@kolla_base_distro: \"rocky\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#network_interface:.*@network_interface: \"${FIRST_INTERFACE}\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#openstack_release:.*@openstack_release: \"2025.2\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#kolla_base_distro:.*@kolla_base_distro: \"rocky\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#network_interface:.*@network_interface: \"${FIRST_INTERFACE}\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#neutron_external_interface:.*@neutron_external_interface: \"${EXTERNAL_INTERFACE}\"@g" "${GLOBALS_FILENAME}"
|
||||
sed -i "s@^#kolla_internal_vip_address:.*@kolla_internal_vip_address: \"${INTERNAL_IP}\"@g" "${GLOBALS_FILENAME}"
|
||||
|
||||
# Define the services you want to toggle
|
||||
SERVICES_TO_ENABLE=(
|
||||
"enable_horizon"
|
||||
"enable_neutron_fwaas"
|
||||
"enable_neutron_qos"
|
||||
# "enable_cinder"
|
||||
# "enable_neutron_fwaas" # <-- remove or comment this out; retired in 2023
|
||||
# "enable_neutron_qos"
|
||||
# "enable_cinder"
|
||||
"enable_mariadb"
|
||||
"enable_valkey"
|
||||
# "skip_cinder_backend_check"
|
||||
# "enable_cinder_backend_nfs"
|
||||
# "enable_cinder_backup"
|
||||
# "enable_octavia"
|
||||
# "skip_cinder_backend_check"
|
||||
# "enable_cinder_backend_nfs"
|
||||
# "enable_cinder_backup"
|
||||
)
|
||||
|
||||
# Call the function
|
||||
enable_kolla_options "${GLOBALS_FILENAME}" "${SERVICES_TO_ENABLE[@]}"
|
||||
|
||||
#sed -i "s@^#enable_cinder_backend_nfs:.*@enable_cinder_backend_nfs: true@g" "${GLOBALS_FILENAME}"
|
||||
#sed -i "s@^#enable_cinder_backend_lvm:.*@enable_cinder_backend_lvm: true@g" "${GLOBALS_FILENAME}"
|
||||
#sed -i "s@^#cinder_volume_group:.*@cinder_volume_group: \"cinder-volumes\"@g" "${GLOBALS_FILENAME}"
|
||||
#sed -i "s@^#enable_octavia:.*@enable_octavia: true@g" "${GLOBALS_FILENAME}"
|
||||
#sed -i "s@^cinder_backup_driver:.*@cinder_backup_driver: \"nfs\"@g" "${GLOBALS_FILENAME}"
|
||||
#sed -i "s@^cinder_backup_share:.*@cinder_backup_share: \"192.168.1.21:/os_data\"@g" "${GLOBALS_FILENAME}"
|
||||
|
||||
cat <<EOF >> "${GLOBALS_FILENAME}"
|
||||
# Octavia cert config — only append if Octavia is actually being enabled
|
||||
if printf '%s\n' "${SERVICES_TO_ENABLE[@]}" | grep -q '^enable_octavia$'; then
|
||||
cat <<EOF >> "${GLOBALS_FILENAME}"
|
||||
octavia_certs_country: IL
|
||||
octavia_certs_state: Shomron
|
||||
octavia_certs_organization: NgTech LTD
|
||||
octavia_certs_organizational_unit: Octavia
|
||||
EOF
|
||||
fi
|
||||
|
||||
# 5. Deployment
|
||||
kolla-ansible bootstrap-servers -i ./all-in-one
|
||||
|
||||
kolla-ansible octavia-certificates -i ./all-in-one
|
||||
# Only run octavia-certificates if Octavia is enabled
|
||||
if printf '%s\n' "${SERVICES_TO_ENABLE[@]}" | grep -q '^enable_octavia$'; then
|
||||
kolla-ansible octavia-certificates -i ./all-in-one
|
||||
fi
|
||||
|
||||
kolla-ansible prechecks -i ./all-in-one
|
||||
|
||||
|
||||
# Since 2026.2
|
||||
#kolla-ansible prechecks -i ./all-in-one --use-test-images
|
||||
|
||||
|
||||
kolla-ansible deploy -i ./all-in-one
|
||||
|
||||
|
||||
# 6. Post-Install
|
||||
# 6. Post-Install (still inside venv)
|
||||
pip install python-openstackclient
|
||||
kolla-ansible post-deploy -i ./all-in-one
|
||||
|
||||
echo "Deployment Complete. Credentials located in /etc/kolla/admin-openrc.sh"
|
||||
deactivate
|
||||
|
||||
pip install -U pip
|
||||
#pip install python-openstackclient
|
||||
|
||||
pip install --ignore-installed python-openstackclient
|
||||
|
||||
set +xe
|
||||
|
||||
@ -23,3 +23,5 @@ fi
|
||||
|
||||
chmod +x /usr/bin/docker-compose
|
||||
|
||||
systemctl enable --now docker
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user