From b6ce9f489ac79393e1c02c31adbb4a27dd8de6e0 Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Thu, 9 Mar 2023 11:02:01 -0500 Subject: [PATCH] autodetect manager IP --- setup/so-functions | 9 +++++++++ setup/so-setup | 5 ++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index e006bac34..26a97583f 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1606,6 +1606,15 @@ networking_needful() { fi set_main_ip compare_main_nic_ip + + # Attempt to autodetect the manager IP, if an offset value exists + if [[ -n "$MSRVIP_OFFSET" && -z "$MSRVIP" ]]; then + mips1=$(echo "$MNIC_IP" | awk -F. '{print $1}') + mips2=$(echo "$MNIC_IP" | awk -F. '{print $2}') + mips3=$(echo "$MNIC_IP" | awk -F. '{print $3}') + mips4=$(echo "$MNIC_IP" | awk -F. '{print $4}') + MSRVIP="$mips1.$mips2.$mips3.$((mips4+$MSRVIP_OFFSET))" + fi } network_setup() { diff --git a/setup/so-setup b/setup/so-setup index 1bee9e617..f430efb4b 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -183,8 +183,10 @@ if [ -n "$test_profile" ]; then if [[ "$test_profile" =~ "-sensor-" ]]; then HOSTNAME=sensor + MSRVIP_OFFSET=-2 elif [[ "$test_profile" =~ "-search-" ]]; then HOSTNAME=search + MSRVIP_OFFSET=-1 else HOSTNAME=manager fi @@ -192,14 +194,11 @@ if [ -n "$test_profile" ]; then MSRV=manager if [[ "$test_profile" =~ "-net" ]]; then address_type=DHCP - MSRVIP=10.66.166.72 elif [[ "$test_profile" =~ "-cloud" ]]; then MSRVIP=10.99.1.20 elif [[ "$test_profile" =~ "-iso" ]]; then - MSRVIP=10.66.166.42 elif [[ "$test_profile" =~ "-airgap" ]]; then is_airgap=true - MSRVIP=10.66.166.52 fi if [ -f "/root/public_ip" ]; then