Skip to content

Instantly share code, notes, and snippets.

@jriguera
Last active March 16, 2018 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jriguera/915a05091964b88dfb96 to your computer and use it in GitHub Desktop.
Save jriguera/915a05091964b88dfb96 to your computer and use it in GitHub Desktop.
Example how to deploy a baremetal server using ironic standalone
#!/bin/bash
# Create the initial ramdkisk
export ELEMENTS_PATH="/home/jriguera/diskimage-builder/elements"
ramdisk-image-create ubuntu deploy-ironic grub-install -o my-deploy-ramdisk
# Create the image to deploy on disk (with ConfigDrive support)
DIB_CLOUD_INIT_DATASOURCES="ConfigDrive, OpenStack" disk-image-create ubuntu baremetal dhcp-all-interfaces -o my-image
# Define the parameter for the new server
NAME=nettest1
MAC=00:25:90:8f:51:a0
IPMI=10.0.0.2
# Ironic in standalone mode!
export OS_AUTH_TOKEN=" "
export IRONIC_URL=http://localhost:6385/
# Define the new server
ironic node-create -n $NAME -d pxe_ipmitool -i ipmi_address=$IPMI -i ipmi_username=ADMIN -i ipmi_password=ADMIN -i deploy_kernel=file:///home/jriguera/images/my-deploy-ramdisk.kernel -i deploy_ramdisk=file:///home/jriguera/images/my-deploy-ramdisk.initramfs
UUID=$(ironic node-list | awk "/$NAME/ { print \$2 }")
# Define the MAC
ironic port-create -n $UUID -a $MAC
MD5=$(md5sum /home/pe/images/my-image.qcow2 | cut -d' ' -f 1)
# Define the rest of the parameters
ironic node-update $UUID add instance_info/image_source=file:///home/jriguera/images/my-image.qcow2 instance_info/kernel=file:///home/jriguera/images/my-image.vmlinuz instance_info/ramdisk=file:///home/jriguera/images/my-image.initrd instance_info/root_gb=100 instance_info/image_checksum=$MD5
# Validate the node
ironic node-validate $UUID
# Create the config drive!!
# Deploy the node
ironic node-set-provision-state --config-drive /configdrive_$NAME $UUID active
@larsks
Copy link

larsks commented Mar 16, 2018

Ironic doesn't like having OS_AUTH_TOKEN set to whitespace...

export OS_AUTH_TOKEN=" "
# ironic node-list
Error has occurred while handling request for http://localhost:6385/v1/nodes: Invalid return character or leading space in header: X-Auth-Token

Set it to something that doesn't contain whitespace.

export OS_AUTH_TOKEN=fake-token
# ironic node-list
The "ironic" CLI is deprecated and will be removed in the S* release. Please use the "openstack baremetal" CLI instead.
+--------------------------------------+---------+...
| UUID                                 | Name    |...
+--------------------------------------+---------+...
| 25497416-4367-48e5-86db-31e86af52320 | node-00 |...
+--------------------------------------+---------+...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment