Periodic update

This commit is contained in:
Super User 2026-06-13 13:34:20 +03:00
parent c18cef26f0
commit da606ad3b8
6 changed files with 255 additions and 22 deletions

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
all:
echo ok
deploy-nfs-config:
stat /etc/kolla
mkdir -p /etc/kolla/config/
cp -vf nfs_shares /etc/kolla/config/nfs_shares

30
cleanup-multinode.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -xe # Added -e to stop execution if a command fails
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
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."
fi
echo "--- Pre-flight Checks Passed! Starting Installation ---"
KOLLA_VENV="/opt/ansible-kolla-venv"
KOLLA_WORKING="/opt/ansible-kolla"
source "${KOLLA_VENV}/bin/activate"
cd "${KOLLA_WORKING}"
ansible -i /opt/ansible-kolla/multinode all -m script -a "/opt/ansible-kolla-venv/share/kolla-ansible/tools/cleanup-host" --become
set +xe

134
deploy-multinode.sh Executable file
View File

@ -0,0 +1,134 @@
#!/usr/bin/env bash
set -xe # Added -e to stop execution if a command fails
# Defaults
FIRST_INTERFACE="${1:-enp1s0}"
# enentually will be physnet1 in open stack networks
EXTERNAL_INTERFACE="${2:-enp3s0}"
# this should not be pingable in the installtion
INTERNAL_IP="${3:-192.168.1.210}"
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
fi
# 3. Ensure the VIP is NOT pingable (must be free)
echo "Checking if VIP $INTERNAL_IP is available..."
if ping -c 1 -W 1 "$INTERNAL_IP" > /dev/null 2>&1; then
echo "ERROR: VIP $INTERNAL_IP is already responding to pings!"
echo "Choose an unused IP in the same subnet as $FIRST_INTERFACE."
exit 1
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."
fi
echo "--- Pre-flight Checks Passed! Starting Installation ---"
KOLLA_VENV="/opt/ansible-kolla-venv"
KOLLA_WORKING="/opt/ansible-kolla"
# 2. Virtual Environment Setup
source "${KOLLA_VENV}/bin/activate"
cd "${KOLLA_WORKING}"
# Install Ansible and Galaxy roles
kolla-ansible install-deps
kolla-genpwd
# 4. Patch globals.yml
GLOBALS_FILENAME="/etc/kolla/globals.yml"
enable_kolla_options() {
local globals_file="$1"
shift # Remove the first argument, leaving only the option names
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@^#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_mariadb"
"enable_valkey"
"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}"
OCTAVIE_CERT_CONF=$(grep "octavia_certs_organizational_unit: Octavia" "${GLOBALS_FILENAME}" |wc -l)
if [ "${OCTAVIE_CERT_CONF}"-eq "0" ]
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 ./multinode
kolla-ansible octavia-certificates -i ./multinode
kolla-ansible prechecks -i ./multinode
# Since 2026.2
#kolla-ansible prechecks -i ./all-in-one --use-test-images
kolla-ansible deploy -i ./multinode
# 6. Post-Install
pip install python-openstackclient
kolla-ansible post-deploy -i ./multinode
echo "Deployment Complete. Credentials located in /etc/kolla/admin-openrc.sh"
deactivate
pip install -U pip
pip install python-openstackclient
set +xe

69
init-multinode.sh Executable file
View File

@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -xe # Added -e to stop execution if a command fails
# Defaults
FIRST_INTERFACE="${1:-enp1s0}"
# enentually will be physnet1 in open stack networks
EXTERNAL_INTERFACE="${2:-enp3s0}"
# this should not be pingable in the installtion
INTERNAL_IP="${3:-192.168.1.210}"
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
fi
# 2. Check if the network interfaces actually exist
for iface in "$FIRST_INTERFACE" "$EXTERNAL_INTERFACE"; do
if ! ip link show "$iface" > /dev/null 2>&1; then
echo "ERROR: Interface $iface not found. Check your 'ip link' output."
# exit 1
fi
done
# 3. Ensure the VIP is NOT pingable (must be free)
echo "Checking if VIP $INTERNAL_IP is available..."
if ping -c 1 -W 1 "$INTERNAL_IP" > /dev/null 2>&1; then
echo "ERROR: VIP $INTERNAL_IP is already responding to pings!"
echo "Choose an unused IP in the same subnet as $FIRST_INTERFACE."
exit 1
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."
fi
echo "--- Pre-flight Checks Passed! Starting Installation ---"
# 1. Install System Dependencies
dnf install -y git python3-devel libffi-devel gcc openssl-devel python3-libselinux plocate
KOLLA_VENV="/opt/ansible-kolla-venv"
KOLLA_WORKING="/opt/ansible-kolla"
mkdir -p "${KOLLA_VENV}" "${KOLLA_WORKING}" /etc/kolla
# 2. Virtual Environment Setup
python3 -m venv "${KOLLA_VENV}"
source "${KOLLA_VENV}/bin/activate"
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
cd "${KOLLA_WORKING}"
stat multinode || cp ${KOLLA_VENV}/share/kolla-ansible/ansible/inventory/multinode .
set +xe

View File

@ -11,7 +11,7 @@ EXTERNAL_INTERFACE="${2:-enp3s0}"
# this should not be pingable in the installtion
INTERNAL_IP="${3:-192.168.220.245}"
INTERNAL_IP="${3:-192.168.210}"
echo "--- Running Pre-flight Checks ---"
@ -65,8 +65,9 @@ pip install git+https://opendev.org/openstack/kolla-ansible@stable/2025.2
cp -r ${KOLLA_VENV}/share/kolla-ansible/etc_examples/kolla/* /etc/kolla
cd "${KOLLA_WORKING}"
stat all-in-one || cp ${KOLLA_VENV}/share/kolla-ansible/ansible/inventory/all-in-one .
stat multinode || cp ${KOLLA_VENV}/share/kolla-ansible/ansible/inventory/multinode .
echo "take your time to setup the config files, then press enter..."
read
# Install Ansible and Galaxy roles
kolla-ansible install-deps
@ -102,12 +103,12 @@ SERVICES_TO_ENABLE=(
"enable_horizon"
"enable_neutron_fwaas"
"enable_neutron_qos"
"enable_cinder"
# "enable_cinder"
"enable_mariadb"
"enable_valkey"
"skip_cinder_backend_check"
"enable_cinder_backend_nfs"
"enable_cinder_backup"
# "skip_cinder_backend_check"
# "enable_cinder_backend_nfs"
# "enable_cinder_backup"
)
# Call the function
@ -117,8 +118,8 @@ enable_kolla_options "${GLOBALS_FILENAME}" "${SERVICES_TO_ENABLE[@]}"
#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}"
#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_certs_country: IL
@ -128,32 +129,23 @@ octavia_certs_organizational_unit: Octavia
EOF
# 5. Deployment
#kolla-ansible bootstrap-servers -i ./all-in-one
kolla-ansible bootstrap-servers -i ./multinode
kolla-ansible bootstrap-servers -i ./all-in-one
kolla-ansible octavia-certificates -i ./all-in-one
#kolla-ansible octavia-certificates -i ./all-in-one
kolla-ansible octavia-certificates -i ./multinode
#kolla-ansible prechecks -i ./all-in-one
kolla-ansible prechecks -i ./multinode
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
kolla-ansible deploy -i ./multinode
kolla-ansible deploy -i ./all-in-one
# 6. Post-Install
pip install python-openstackclient
#kolla-ansible post-deploy -i ./all-in-one
kolla-ansible post-deploy -i ./multinode
kolla-ansible post-deploy -i ./all-in-one
echo "Deployment Complete. Credentials located in /etc/kolla/admin-openrc.sh"
deactivate

1
nfs_shares Normal file
View File

@ -0,0 +1 @@
192.168.1.21:/srv/os_data