summaryrefslogtreecommitdiff
path: root/reorder_override.sh
blob: 35edb2f906ce6eb7bbfea82e3bb6532695b9e878 (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
#!/usr/bin/env bash

echo "Reassigning container IPs in increments of 10..."

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"
)

for container in "${!CONTAINERS[@]}"; do
  new_ip="${CONTAINERS[$container]}"
  echo "➑️ Overriding eth0 device for $container..."
  lxc config device override "$container" eth0
  echo "πŸ”§ Setting $container to IP $new_ip..."
  lxc config device set "$container" eth0 ipv4.address "$new_ip"
done

echo "πŸ”„ Restarting containers to apply new IPs..."
for container in "${!CONTAINERS[@]}"; do
  echo "πŸ”„ Restarting $container..."
  lxc restart "$container"
done

echo "βœ… IP assignment complete! Here’s the new layout:"
lxc list