openstack-virtual-baremetal/bin/rebuild-baremetal
Ben Nemec 740d72b134 Add rebuild-baremetal script
This is a helper script to rebuild all baremetal instances in
environments where the Nova PXE boot patch is not applied.
2018-02-14 11:13:05 -06:00

27 lines
756 B
Bash
Executable File

#!/bin/bash
# Script to rebuild baremetal instances to the ipxe-boot image.
# When using OVB without the Nova PXE boot patch, this is required after
# each deployment to ensure the nodes can PXE boot for the next one.
# Usage: rebuild-baremetal <number of nodes> [baremetal_base] [environment ID]
# Examples: rebuild-baremetal 2
# rebuild-baremetal 5 my-baremetal-name
# rebuild-baremetal 5 baremetal test
node_num=$1
baremetal_base=${2:-'baremetal'}
env_id=${3:-}
name_base="$baremetal_base"
if [ -n "$env_id" ]
then
name_base="$baremetal_base-$env_id"
fi
for i in `seq 0 $((node_num - 1))`
do
echo nova rebuild "${instance_list}${name_base}_$i" ipxe-boot
nova rebuild "${instance_list}${name_base}_$i" ipxe-boot
done