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.Cpus

host.get_fact(Cpus)

Returns the number of CPUs on this server.

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.Memory

host.get_fact(Memory)

Returns the memory installed in this server, in MB.

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.

{
    "eth0": {
        "ipv4": {
            "address": "127.0.0.1",
            "broadcast": "127.0.0.13",
            # Only one of these will exist:
            "netmask": "255.255.255.255",
            "mask_bits": 32,
        },
        "ipv6": {
            "address": "fe80::a00:27ff:fec3:36f0",
            "mask_bits": 64,
            "additional_ips": [{
                "address": "fe80::",
                "mask_bits": 128,
            }],
        }
    },
}