Hardware Facts

hardware.BlockDevices

host.get_fact(BlockDevices, )

rns a dict of (mounted) block devices:

ode:: python

{
“/dev/sda1”: {

“available”: “39489508”, “used_percent”: “3”, “mount”: “/”, “used”: “836392”, “blocks”: “40325900”

},

}

hardware.Cpus

host.get_fact(Cpus, )

rns the number of CPUs on this server.

hardware.Ipv4Addresses

host.get_fact(Ipv4Addresses)

& returns a dictionary of network interface -> IPv4 address.

ode:: python

{

“eth0”: “127.0.0.1”,

}

arning:: This fact is deprecated, please use the hardware.Ipv4Addrs fact.

ote:: Network interfaces with no IPv4 will not be part of the dictionary.

hardware.Ipv4Addrs

host.get_fact(Ipv4Addrs)

& returns a dictionary of network interface -> list of IPv4 addresses.

ode:: python

{

“eth0”: [“127.0.0.1”],

}

ote:: Network interfaces with no IPv4 will not be part of the dictionary.

hardware.Ipv6Addresses

host.get_fact(Ipv6Addresses)

& returns a dictionary of network interface -> IPv6 address.

ode:: python

{

“eth0”: “fe80::a00:27ff::2”,

}

arning:: This fact is deprecated, please use the hardware.Ipv6Addrs fact.

ote:: Network interfaces with no IPv6 will not be part of the dictionary.

hardware.Ipv6Addrs

host.get_fact(Ipv6Addrs)

& returns a dictionary of network interface -> list of IPv6 addresses.

ode:: python

{

“eth0”: [“fe80::a00:27ff::2”],

}

ote:: Network interfaces with no IPv6 will not be part of the dictionary.

hardware.Memory

host.get_fact(Memory, )

rns the memory installed in this server, in MB.

hardware.NetworkDevices

host.get_fact(NetworkDevices, )

& returns a dict of network devices. See the ipv4_addresses and v6_addresses`` facts for easier-to-use shortcuts to get device addresses.

ode:: python

“enp1s0”: {

“ether”: “12:34:56:78:9A:BC”, “mtu”: 1500, “state”: “UP”, “ipv4”: {

“address”: “192.168.1.100”, “mask_bits”: 24, “netmask”: “255.255.255.0”

}, “ipv6”: {

“address”: “2001:db8:85a3::8a2e:370:7334”, “mask_bits”: 64, “additional_ips”: [

{

“address”: “fe80::1234:5678:9abc:def0”, “mask_bits”: 64

}

]

}

}, “incusbr0”: {

“ether”: “DE:AD:BE:EF:CA:FE”, “mtu”: 1500, “state”: “UP”, “ipv4”: {

“address”: “10.0.0.1”, “mask_bits”: 24, “netmask”: “255.255.255.0”

}, “ipv6”: {

“address”: “fe80::dead:beef:cafe:babe”, “mask_bits”: 64, “additional_ips”: [

{

“address”: “2001:db8:1234:5678::1”, “mask_bits”: 64

}

]

}

}, “lo”: {

“mtu”: 65536, “state”: “UP”, “ipv6”: {

“address”: “::1”, “mask_bits”: 128

}

}, “veth98806fd6”: {

“ether”: “AA:BB:CC:DD:EE:FF”, “mtu”: 1500, “state”: “UP”

}, “vethda29df81”: {

“ether”: “11:22:33:44:55:66”, “mtu”: 1500, “state”: “UP”

}, “wlo1”: {

“ether”: “77:88:99:AA:BB:CC”, “mtu”: 1500, “state”: “UNKNOWN”

}