Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid

Deploy OpenStack host with Ironic and Redfish

Define node variables

NODE=com4-dev
NODE_BMC_HOST=com4-dev.ipmi.dev.i.example.com
NODE_MAC_NIC1=00:11:22:33:44:55

Define env variables

NODE_BMC_USER=ADMIN
NODE_BMC_PASS=ADMIN

Create now node with Redfish (pxe device boot broken)
https://docs.openstack.org/ironic/latest/admin/drivers/redfish.html

openstack baremetal node create \
  --name ${NODE} \
  --driver redfish \
  --driver-info redfish_address="https://${NODE_BMC_HOST}" \
  --driver-info redfish_username=${NODE_BMC_USER} \
  --driver-info redfish_password=${NODE_BMC_PASS} \
  --driver-info redfish_verify_ca=false \
  --driver-info redfish_system_id=/redfish/v1/Systems/1

Create now node with IPMI
https://docs.openstack.org/ironic/latest/admin/drivers/ipmitool.html

openstack baremetal node create \
  --name ${NODE} \
  --driver ipmi \
  --driver-info ipmi_address=${NODE_BMC_HOST} \
  --driver-info ipmi_username=${NODE_BMC_USER} \
  --driver-info ipmi_password=${NODE_BMC_PASS}

iPXE
https://docs.openstack.org/ironic/latest/admin/interfaces/boot.html#pxe-boot

openstack baremetal node set ${NODE} \
  --boot-interface ipxe \
  --driver-info deploy_kernel="http://10.33.33.40:8080/ansible_ubuntu.vmlinuz" \
  --driver-info deploy_ramdisk="http://10.33.33.40:8080/ansible_ubuntu.initramfs"

Image
https://docs.openstack.org/ironic/latest/admin/interfaces/boot.html#pxe-boot

Get server(s) power consumption

bmc_credentials.conf

export BMC_USER=ADMIN
export BMC_PASS=ADMIN

get-power-consumption.sh

#!/bin/bash

# source BMC credentials
. $(dirname "${BASH_SOURCE[0]}")/bmc_credentials.conf

if [ $# -eq 1 ]; then
    BMC_NODES="${1}"
else
    echo "Usage: $0 \"\""
    echo "e.g $0 \"10.0.0.1 \$(echo 10.0.2.{10..20})\""
    exit
fi

printf "%-40s %-10s %-10s\n" "Server" "Current" "AVG"
for BMC_NODE in ${BMC_NODES}; do
    POWER_CONSUMPTION=$(curl --connect-timeout 3 -s https://${BMC_NODE}/redfish/v1/Chassis/1/Power/ -k -u ${BMC_USER}:${BMC_PASS} | jq -r ".PowerControl[].PowerConsumedWatts")
    [ -z ${POWER_CONSUMPTION} ] && POWER_CONSUMPTION=$(ipmitool -I lanplus -H ${BMC_NODE} -U ${BMC_USER} -P ${BMC_PASS} dcmi power reading | awk '/Instantaneous/ {print $(NF-1)}')

    POWER_CONSUMPTION_AVG=$(curl --connect-timeout 3 -s https://${BMC_NODE}/redfish/v1/Chassis/1/Power/ -k -u ${BMC_USER}:${BMC_PASS} | jq -r ".PowerControl[].PowerMetrics.AverageConsumedWatts")
    [ -z ${POWER_CONSUMPTION_AVG} ] && POWER_CONSUMPTION_AVG=$(ipmitool -I lanplus -H ${BMC_NODE} -U ${BMC_USER} -P ${BMC_PASS} dcmi power reading | awk '/Average/ {print $(NF-1)}')

    printf "%-40s %-10s %-10s\n" "${BMC_NODE}" "${POWER_CONSUMPTION}" "${POWER_CONSUMPTION_AVG}"
done

define server (BMC) list

BMC_NODES="
10.0.0.222
$(echo www{1..9}.example.com)
$(echo 10.0.1.{101..201})
"

Get data from redfish / ipmi

Redfish

BMC_IP=10.0.1.123
BMC_USER=ADMIN
BMC_PASS=ADMIN

# Install redfishtool (CLI)
git clone  https://github.com/DMTF/Redfishtool.git
cd Redfishtool/
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F

for BMC_IP in 10.0.1.11 10.0.1.12 10.0.1.13; do
    python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .SerialNumber
    python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .IndicatorLED
done

BMC_HOSTS=$(grep 10.52 /var/lib/misc/dnsmasq.leases | cut -d" " -f3 | sort)
for BMC_HOST in ${BMC_HOSTS}; do
    echo ${BMC_HOST}
    curl --connect-timeout 1 -s https://${BMC_HOST}/redfish/v1/Systems/1/ -k -u ${BMC_USER}:${BMC_PASS} | jq -r .IndicatorLED
  echo
done

python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Chassis list
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Chassis -I 1
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Chassis -I HA-RAID.0.StorageEnclosure.0

python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .UUID
python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Systems -F | jq .IndicatorLED

python3 redfishtool.py -r ${BMC_IP} -u ${BMC_USER} -p ${BMC_PASS} Chassis -I 1 setIndicatorLed Off

BMC_IP=$(dig +short node1.example.com)
redfish
Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung