Skip to main content

Hardware Template Variables​

When a node is registered, hardware data is collected and made available to the MachineRegistration in a way similar to SMBIOS variables.

This data can be used for easy identification and selection via a MachineSelector.

The following are available for templating:

VariableDescription
${System Data/Runtime/Hostname}The hostname of the node (at registration time)
${System Data/Memory/Total Physical Bytes}The total RAM memory in the node, expressed in bytes
${System Data/CPU/Total Cores}Total CPU cores
${System Data/CPU/Total Threads}Total CPU threads
${System Data/CPU/Vendor}CPU vendor
${System Data/CPU/Model}CPU model
${System Data/GPU/Vendor}GPU vendor (Only available if the node has an identifiable GPU)
${System Data/GPU/Model}GPU model (Only available if the node has an identifiable GPU)
${System Data/Network/Number Interfaces}Number of network interfaces in the system
${System Data/Network/{Iface name}/Name}Network interface name
${System Data/Network/{Iface name}/IsVirtual}Boolean indicating virtual network interface
${System Data/Block Devices/Number Devices}Number of block devices in the system (includes DVD and USB drives)
${System Data/Block Devices/{Disk name}/Name}Device name of the block device (i.e. sda, sr0, vda, etc...)
${System Data/Block Devices/{Disk name}/Removable}Whether this block device is removable (i.e. DVD)
${System Data/Block Devices/{Disk name}/Size}Total space in this block device, expressed in bytes
${System Data/Block Devices/{Disk name}/Drive Type}Drive type of this block device, see table below
${System Data/Block Devices/{Disk name}/Storage Controller}Controller type for this block device connection, see table below
info

On both Block Devices and Network the device name is used as a sub-block, as there could be more than one device.

Block device drive types​

TypeDescription
HDDHard disk drive
FDDFloppy disk drive
ODDOptical disk drive
SSDSolid-state drive
virtualvirtual drive i.e. loop devices
Unknownunknown drive type

Block device controller types​

TypeDescription
IDEIntegrated Drive Electronics
SCSISmall computer system interface
NVMeNon-volatile Memory Express
MMCMulti-media controller (used for mobile phone storage devices)
virtioVirtualized storage controller/driver
looploop device
Unknownunknown controller type

Example MachineRegistration​

registration example with Hardware template variables
apiVersion: elemental.cattle.io/v1beta1
kind: MachineRegistration
metadata:
name: my-nodes
namespace: fleet-default
spec:
machineName: "${System Data/Runtime/Hostname}"
config:
cloud-config:
users:
- name: root
passwd: root
elemental:
install:
reboot: true
device: /dev/sda
debug: true
machineInventoryLabels:
elemental.cattle.io/CpuTotalCores: "${System Data/CPU/Total Cores}"
elemental.cattle.io/CpuTotalThreads: "${System Data/CPU/Total Threads}"
elemental.cattle.io/TotalMemoryBytes: "${System Data/Memory/Total Physical Bytes}"
elemental.cattle.io/NumberBlockDevices: "${System Data/Block Devices/Number Devices}"