Files
Sankofa/scripts/download-ubuntu-cloud-image.sh
defiQUG 9daf1fd378 Apply Composer changes: comprehensive API updates, migrations, middleware, and infrastructure improvements
- Add comprehensive database migrations (001-024) for schema evolution
- Enhance API schema with expanded type definitions and resolvers
- Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth
- Implement new services: AI optimization, billing, blockchain, compliance, marketplace
- Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage)
- Update Crossplane provider with enhanced VM management capabilities
- Add comprehensive test suite for API endpoints and services
- Update frontend components with improved GraphQL subscriptions and real-time updates
- Enhance security configurations and headers (CSP, CORS, etc.)
- Update documentation and configuration files
- Add new CI/CD workflows and validation scripts
- Implement design system improvements and UI enhancements
2025-12-12 18:01:35 -08:00

77 lines
2.4 KiB
Bash
Executable File

#!/bin/bash
# Download Ubuntu 22.04 Cloud Image to Proxmox
# Run this on the Proxmox node or from a machine with SSH access
set -euo pipefail
PROXMOX_NODE="${1:-192.168.11.10}"
PROXMOX_PASS="${PROXMOX_PASS:-L@kers2010}"
STORAGE="${STORAGE:-local-lvm}"
IMAGE_NAME="ubuntu-22.04-server-cloudimg-amd64.img"
IMAGE_URL="https://cloud-images.ubuntu.com/releases/22.04/release/${IMAGE_NAME}"
echo "=========================================="
echo "Downloading Ubuntu 22.04 Cloud Image"
echo "=========================================="
echo ""
echo "Node: $PROXMOX_NODE"
echo "Storage: $STORAGE"
echo "Image: $IMAGE_NAME"
echo ""
# Check if image already exists
echo "Checking if image already exists..."
if sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@$PROXMOX_NODE "pvesm list $STORAGE | grep -q '$IMAGE_NAME'"; then
echo "✅ Image already exists in $STORAGE"
exit 0
fi
# Download image to Proxmox node
echo "Downloading image to Proxmox node..."
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@$PROXMOX_NODE "
cd /tmp
if [ ! -f $IMAGE_NAME ]; then
echo 'Downloading from $IMAGE_URL...'
wget -q --show-progress $IMAGE_URL -O $IMAGE_NAME
echo '✅ Download complete'
else
echo 'Image already downloaded locally'
fi
"
# Upload to Proxmox storage
echo ""
echo "Uploading image to Proxmox storage ($STORAGE)..."
sshpass -p "$PROXMOX_PASS" ssh -o StrictHostKeyChecking=no root@$PROXMOX_NODE "
# Create storage path if needed
mkdir -p /var/lib/vz/template/iso
# Copy to storage
if [ -f /tmp/$IMAGE_NAME ]; then
echo 'Copying to storage...'
cp /tmp/$IMAGE_NAME /var/lib/vz/template/iso/$IMAGE_NAME
echo '✅ Image uploaded to /var/lib/vz/template/iso/$IMAGE_NAME'
# Verify
if pvesm list $STORAGE | grep -q '$IMAGE_NAME'; then
echo '✅ Image verified in storage'
else
echo '⚠️ Image copied but not showing in storage list'
echo 'You may need to refresh storage or use full path: local:$IMAGE_NAME'
fi
else
echo '❌ Image file not found after download'
exit 1
fi
"
echo ""
echo "=========================================="
echo "✅ Ubuntu 22.04 Cloud Image Ready"
echo "=========================================="
echo ""
echo "Image location: /var/lib/vz/template/iso/$IMAGE_NAME"
echo "Use in templates as: local:$IMAGE_NAME"
echo "Or: $STORAGE:$IMAGE_NAME"
echo ""