summaryrefslogtreecommitdiff
path: root/reorder_validation.sh
blob: 29de3f3fbe6b16d11f1887bdb5736053b219461a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash

echo "🔍 Starting IP validation and connectivity tests..."

declare -A CONTAINERS
CONTAINERS=(
  [archivecontrol]="10.196.1.10"
  [archivelist]="10.196.1.20"
  [ftp]="10.196.1.30"
  [hostingtoot]="10.196.1.40"
  [humptydumpty]="10.196.1.50"
  [teamtalk]="10.196.1.60"
  [akkoma]="10.196.1.70"
)

for container in "${!CONTAINERS[@]}"; do
  expected_ip="${CONTAINERS[$container]}"
  echo "🔎 Checking $container..."

  # Get actual IP from inside container
  actual_ip=$(lxc exec "$container" -- hostname -I | awk '{print $1}')
  
  # Compare expected vs actual IP
  if [[ "$expected_ip" == "$actual_ip" ]]; then
    echo "✅ $container IP matches expected: $expected_ip"
  else
    echo "❌ $container IP mismatch! Expected: $expected_ip, Found: $actual_ip"
  fi

  # Ping test from host
  echo "📡 Pinging $expected_ip..."
  ping -c 2 "$expected_ip" > /dev/null 2>&1
  if [[ $? -eq 0 ]]; then
    echo "✅ Ping to $expected_ip successful"
  else
    echo "❌ Ping to $expected_ip failed"
  fi

  # DNS hostname inside container
  container_hostname=$(lxc exec "$container" -- hostname)
  echo "🌐 $container DNS hostname: $container_hostname"
  echo "-------------------------------------------"
done

echo "🌈 Validation and connectivity tests complete!"