Hardware Facts¶
hardware.BlockDevices
¶
host.get_fact(BlockDevices, )
Returns a dict of (mounted) block devices:
{
"/dev/sda1": {
"available": "39489508",
"used_percent": "3",
"mount": "/",
"used": "836392",
"blocks": "40325900"
},
}
hardware.Ipv4Addresses
¶
host.get_fact(Ipv4Addresses)
Gets & returns a dictionary of network interface -> IPv4 address.
{
"eth0": "127.0.0.1",
}
Warning
This fact is deprecated, please use the hardware.Ipv4Addrs
fact.
Note
Network interfaces with no IPv4 will not be part of the dictionary.
hardware.Ipv4Addrs
¶
host.get_fact(Ipv4Addrs)
Gets & returns a dictionary of network interface -> list of IPv4 addresses.
{
"eth0": ["127.0.0.1"],
}
Note
Network interfaces with no IPv4 will not be part of the dictionary.
hardware.Ipv6Addresses
¶
host.get_fact(Ipv6Addresses)
Gets & returns a dictionary of network interface -> IPv6 address.
{
"eth0": "fe80::a00:27ff::2",
}
Warning
This fact is deprecated, please use the hardware.Ipv6Addrs
fact.
Note
Network interfaces with no IPv6 will not be part of the dictionary.
hardware.Ipv6Addrs
¶
host.get_fact(Ipv6Addrs)
Gets & returns a dictionary of network interface -> list of IPv6 addresses.
{
"eth0": ["fe80::a00:27ff::2"],
}
Note
Network interfaces with no IPv6 will not be part of the dictionary.
hardware.NetworkDevices
¶
host.get_fact(NetworkDevices, )
Gets & returns a dict of network devices. See the ipv4_addresses
and
ipv6_addresses
facts for easier-to-use shortcuts to get device addresses.
"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"
}