diff --git a/vm_automation/alpine/tasks/install_alpine.sh b/vm_automation/alpine/tasks/install_alpine.sh index 6496271..dc8fd6d 100644 --- a/vm_automation/alpine/tasks/install_alpine.sh +++ b/vm_automation/alpine/tasks/install_alpine.sh @@ -41,7 +41,7 @@ EOF" ssh -o StrictHostKeyChecking=no root@${STAGING_IP} "echo 'y' | setup-alpine -e -f /tmp/alpine-answers" # Wait for installation to complete -sleep 45 +sleep 65 # Reboot via SSH ssh -o StrictHostKeyChecking=no root@${STAGING_IP} "reboot" @@ -56,4 +56,4 @@ if ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 root@${STAGING_IP} "echo else echo '{"status": "failure", "message": "Failed to install Alpine"}' exit 1 -fi \ No newline at end of file +fi diff --git a/vm_automation/alpine/tasks/validate_vm_parameters.json b/vm_automation/alpine/tasks/validate_vm_parameters.json index d4de9a1..58f8990 100644 --- a/vm_automation/alpine/tasks/validate_vm_parameters.json +++ b/vm_automation/alpine/tasks/validate_vm_parameters.json @@ -15,7 +15,7 @@ "type": "String" }, "network": { - "description": "Network to connect the VM to (wan-verizon or internal-moeny)", + "description": "Network to connect the VM to (wan-verizon, internal-moeny or virtual-masiero)", "type": "String" }, "ip_with_cidr": { @@ -75,4 +75,4 @@ "type": "String" } } -} \ No newline at end of file +} diff --git a/vm_automation/alpine/tasks/validate_vm_parameters.sh b/vm_automation/alpine/tasks/validate_vm_parameters.sh index 9209fa1..0a193a4 100755 --- a/vm_automation/alpine/tasks/validate_vm_parameters.sh +++ b/vm_automation/alpine/tasks/validate_vm_parameters.sh @@ -89,6 +89,13 @@ validate_network_relationships() { if [[ "$gateway_ip" != "10.44.0.1" ]]; then output_warning "internal-moeny network typically uses 10.44.0.1 as gateway, but got ${gateway_ip}" fi + elif [[ "$network" == "virtual-masiero" ]]; then + if [[ ! "$ip_network" =~ ^10\.10\.0$ ]]; then + output_warning "virtual-masiero network typically uses 10.10.0/24 range, but got ${ip_network}.0/${cidr}" + fi + if [[ "$gateway_ip" != "10.10.0.1" ]]; then + output_warning "virtual-masiero network typically uses 10.10.0.1 as gateway, but got ${gateway_ip}" + fi fi } @@ -96,7 +103,7 @@ validate_network_relationships() { validate_target_host() { local host=$1 if [[ "$host" != "vortex" && "$host" != "astrocore" ]]; then - output_status "error" "Invalid target_host '$host'. Must be either vortex or astrocore" + output_status "error" "Invalid target_host '$host'. Must be either vortex or astrocore." fi } @@ -112,8 +119,8 @@ validate_hostname() { # Function to validate network validate_network() { local network=$1 - if [[ "$network" != "wan-verizon" && "$network" != "internal-moeny" ]]; then - output_status "error" "Invalid network '$network'. Must be either wan-verizon or internal-moeny" + if [[ "$network" != "wan-verizon" && "$network" != "internal-moeny" && "$network" != "virtual-masiero" ]]; then + output_status "error" "Invalid network '$network'. Must be either wan-verizon, internal-moeny or virtual-masiero." fi } @@ -221,4 +228,4 @@ validate_ip "$PT_nameserver2" "secondary nameserver" validate_ip "$PT_nameserver3" "tertiary nameserver" # If we get here, all validations passed -output_status "success" "All parameters validated successfully" \ No newline at end of file +output_status "success" "All parameters validated successfully" diff --git a/vm_automation/common/tasks/check_ip_availability.json b/vm_automation/common/tasks/check_ip_availability.json index d18cef3..791c25c 100644 --- a/vm_automation/common/tasks/check_ip_availability.json +++ b/vm_automation/common/tasks/check_ip_availability.json @@ -3,7 +3,7 @@ "parameters": { "network": { "type": "String", - "description": "Network type (internal-moeny or wan-verizon)" + "description": "Network type (internal-moeny, wan-verizon or virtual-masiero)" } } -} \ No newline at end of file +} diff --git a/vm_automation/common/tasks/check_ip_availability.sh b/vm_automation/common/tasks/check_ip_availability.sh index 2db3141..3711f98 100644 --- a/vm_automation/common/tasks/check_ip_availability.sh +++ b/vm_automation/common/tasks/check_ip_availability.sh @@ -9,8 +9,10 @@ if [ "$network" = "internal-moeny" ]; then ping_ip="10.44.0.250" elif [ "$network" = "wan-verizon" ]; then ping_ip="100.40.223.190" +elif [ "$network" = "virtual-masiero" ]; then + ping_ip="10.10.0.250" else - echo "{\"status\": \"error\", \"message\": \"Unsupported network type: $network. Must be either internal-moeny or wan-verizon.\"}" + echo "{\"status\": \"error\", \"message\": \"Unsupported network type: $network. Must be either internal-moeny, wan-verizon or virtual-masiero.\"}" exit 1 fi @@ -21,4 +23,4 @@ if ping -c 1 -W 3 "$ping_ip" > /dev/null 2>&1; then else echo "{\"status\": \"success\", \"message\": \"IP $ping_ip is available.\"}" exit 0 -fi \ No newline at end of file +fi diff --git a/vm_automation/ubuntu/tasks/validate_vm_parameters.sh b/vm_automation/ubuntu/tasks/validate_vm_parameters.sh index d230819..667fd3f 100755 --- a/vm_automation/ubuntu/tasks/validate_vm_parameters.sh +++ b/vm_automation/ubuntu/tasks/validate_vm_parameters.sh @@ -66,7 +66,7 @@ validate_network_relationships() { # Validate network relationships if [[ "$ip_network" != "$gateway_network" ]]; then - output_status "error" "IP ($ip) and gateway ($gateway_ip) must be in the same network" + output_status "error" "IP ($ip) and gateway ($gateway_ip) must be in the same network." fi # Network-specific validations @@ -90,6 +90,16 @@ validate_network_relationships() { if [[ "$staging_ip" != "internal" ]]; then output_warning "internal-moeny network typically uses 'internal' for staging_ip, but got '${staging_ip}'" fi + elif [[ "$network" == "virtual-masiero" ]]; then + if [[ ! "$ip_network" =~ ^10\.10\.0$ ]]; then + output_warning "virtual-masiero network typically uses 10.10.0.0/24 range, but got ${ip_network}.0/${cidr}" + fi + if [[ "$gateway_ip" != "10.10.0.1" ]]; then + output_warning "virtual-masiero network typically uses 10.10.0.1 as gateway, but got ${gateway_ip}" + fi + if [[ "$staging_ip" != "internal" ]]; then + output_warning "virtual-masiero network typically uses 'internal' for staging_ip, but got '${staging_ip}'" + fi fi } @@ -97,7 +107,7 @@ validate_network_relationships() { validate_target_host() { local host=$1 if [[ "$host" != "vortex" && "$host" != "astrocore" ]]; then - output_status "error" "Invalid target_host '$host'. Must be either vortex or astrocore" + output_status "error" "Invalid target_host '$host'. Must be either vortex or astrocore." fi } @@ -114,7 +124,7 @@ validate_hostname() { validate_network() { local network=$1 if [[ "$network" != "wan-verizon" && "$network" != "internal-moeny" ]]; then - output_status "error" "Invalid network '$network'. Must be either wan-verizon or internal-moeny" + output_status "error" "Invalid network '$network'. Must be either wan-verizon or internal-moeny." fi } @@ -154,7 +164,7 @@ validate_iso_path() { # Extract just the filename from the path local filename=$(basename "$path") if [[ ! "$filename" =~ ^ubuntu ]]; then - output_warning "ISO filename ('${filename}') should typically begin with 'ubuntu'" + output_warning "ISO filename ('${filename}') should typically begin with 'ubuntu.'" fi } @@ -162,7 +172,7 @@ validate_iso_path() { validate_staging_ip() { local staging_ip=$1 if [[ "$staging_ip" != "public" && "$staging_ip" != "internal" ]]; then - output_status "error" "Invalid staging_ip '$staging_ip'. Must be either public or internal" + output_status "error" "Invalid staging_ip '$staging_ip'. Must be either public or internal." fi } @@ -187,7 +197,7 @@ validate_disk_path() { validate_os_variant() { local variant=$1 if ! echo "$variant" | grep -qE '^ubuntu[0-9]{2}\.[0-9]{2}$'; then - output_status "error" "Invalid os_variant '$variant'. Must be in format 'ubuntuXX.XX' (e.g. ubuntu22.04)" + output_status "error" "Invalid os_variant '$variant'. Must be in format 'ubuntuXX.XX' (e.g. ubuntu22.04)." fi } @@ -197,7 +207,7 @@ validate_name_relationships() { local hostname=$2 if [[ "$vm_name" != "$hostname" ]]; then - output_warning "vm_name ('${vm_name}') typically matches hostname ('${hostname}')" + output_warning "vm_name ('${vm_name}') typically matches hostname ('${hostname}')." fi } @@ -229,4 +239,4 @@ validate_ip "$PT_nameserver3" "tertiary nameserver" validate_network_relationships "$PT_network" "$PT_ip_with_cidr" "$PT_gateway_ip" "$PT_staging_ip" # If we get here, all validations passed -output_status "success" "All parameters validated successfully" \ No newline at end of file +output_status "success" "All parameters validated successfully."