Last active
March 16, 2018 22:56
-
-
Save jriguera/915a05091964b88dfb96 to your computer and use it in GitHub Desktop.
Example how to deploy a baremetal server using ironic standalone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ironic doesn't like having
OS_AUTH_TOKEN
set to whitespace...Set it to something that doesn't contain whitespace.