Skip to content

Instantly share code, notes, and snippets.

@goneri
Created September 12, 2017 20:26
Show Gist options
  • Save goneri/59af0d8a714fa5ba389a508c2e668797 to your computer and use it in GitHub Desktop.
Save goneri/59af0d8a714fa5ba389a508c2e668797 to your computer and use it in GitHub Desktop.
Ironic BM from the undercloud
set -eux
function cleanup() {
openstack server list -f value -c ID|xargs -r -n1 openstack server delete --wait
openstack flavor show rhcert && openstack flavor delete rhcert
openstack baremetal list -f value -c UUID|xargs -r -n1 openstack baremetal delete
}
cleanup
openstack flavor create --ram 1024 --disk 20 --vcpus 1 rhcert
openstack flavor set --property capabilities:boot_option="local" rhcert
openstack baremetal import --json instackenv.json
DEPLOY_KERNEL=$(openstack image show bm-deploy-kernel -f value -c id)
DEPLOY_RAMDISK=$(openstack image show bm-deploy-ramdisk -f value -c id)
for node in $(openstack baremetal list -f value -c UUID); do
ironic node-update ${node} add driver_info/deploy_kernel=$DEPLOY_KERNEL
ironic node-update ${node} add driver_info/deploy_ramdisk=$DEPLOY_RAMDISK
ironic node-update ${node} add properties/capabilities="profile:rhcert,boot_option:local"
ironic node-set-provision-state ${node} manage
ironic node-set-provision-state ${node} provide
done
sleep 120
nbr_instances=$(openstack baremetal list -f value -c UUID|wc -l)
openstack server create bob --image overcloud-full --flavor rhcert --min ${nbr_instances} --max ${nbr_instances} --wait
[[ $(openstack server list -f value -c Status|grep -v ACTIVE) == "" ]] || BAD
[[ $(openstack baremetal list -f value -c 'Provisioning State'|grep -v active) == "" ]] || BAD
cleanup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment