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.
This commit is contained in:
Ben Nemec 2018-02-14 11:13:05 -06:00
parent 03160b1aeb
commit 740d72b134
1 changed files with 26 additions and 0 deletions

26
bin/rebuild-baremetal Executable file
View File

@ -0,0 +1,26 @@
#!/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