#!/bin/bash set -euo pipefail ############################################################################# # Title : Confluent Setup Script # Description : This script handles installation and configuration of the # Confluent Virtual Machine in OCF Steel Stack # Author : OCF Limited Research and Development Team (RS) # Date : 2026-02-10 # Version : 26.0.0 # Usage : sudo bash ./confluent_setup.sh # Notes : Script will be converted to an Ansible role ############################################################################# ### ============ ### Variables ### ============ DNSMASQ_INF=enp0s18 DNSMASQ_RANGE=172.22.1.1,172.22.1.100 GATEWAY=172.22.1.252 DOMAIN="ansible1.steelstack.io" UPSTREAM_DNS="172.22.1.220" NODE_IP="172.22.1.{n1}" ADMIN_USER="ocflocal" ADMIN_PASS="" # replace API_USER="apiuser" API_PASS="apiuser" SSH_KEY="/root/.ssh/id_ed25519" OS_DIST=redhat OS_VER=$(grep 'VERSION_ID=' /etc/os-release | awk -F '"' '{print $2}') OS_VER_MAJOR=$(echo $OS_VER | awk -F '.' '{print $1}') OS_VER_MINOR=$(echo $OS_VER | awk -F '.' '{ print $2 }') echo "=== Prompt for Confluent admin password ===" read -s -p "Enter Confluent admin password for user ${ADMIN_USER}: " ADMIN_PASS echo # ========================= # Set rhel to redhat # ========================= echo "=== Ensure rhel references are changed to redhat for consistency with mirror.steelstack.io ===" if [ $(grep 'ID=' /etc/os-release | head -1 | awk -F '\"' '{ print $2 }') == "rhel" ] then os_dist="redhat" else os_dist=$(grep 'ID=' /etc/os-release | head -1 | awk -F '\"' '{ print $2 }') fi # ========================= # Logging # ========================= LOG_FILE="/root/confluent_setup.log" exec > >(tee -a "$LOG_FILE") 2>&1 echo "=== Starting Confluent setup at $(date) ===" ### ====================== ### Root check ### ====================== if [[ $(id -u) -ne 0 ]]; then echo "ERROR: Must run as root." exit 1 fi sudo tee -a /etc/hosts >/dev/null </etc/dnsmasq.conf </dev/null | grep -q "^${ADMIN_USER}$"; then echo "User exists, skipping." else confetty create "/users/${ADMIN_USER}" role=admin password="${ADMIN_PASS}" fi echo "=== Confluent bootstrap complete ==="