Obtain interface information for *NIX/BSD variants in remote servers.

    Example output from a remote node with a couple of interfaces::

        {'eth0': {'hwaddr': '08:00:27:08:c2:e4',
                  'inet': [{'address': '10.0.2.15',
                            'broadcast': '10.0.2.255',
                            'label': 'eth0',
                            'netmask': '255.255.255.0'}],
                  'inet6': [{'address': 'fe80::a00:27ff:fe08:c2e4',
                             'prefixlen': '64'}],
                  'up': True},
         'eth1': {'hwaddr': '08:00:27:70:06:f1',
                  'inet': [{'address': '192.168.111.101',
                            'broadcast': '192.168.111.255',
                            'label': 'eth1',
                            'netmask': '255.255.255.0'}],
                  'inet6': [{'address': 'fe80::a00:27ff:fe70:6f1',
                             'prefixlen': '64'}],
                  'up': True},
         'lo': {'hwaddr': '00:00:00:00:00:00',
                'inet': [{'address': '127.0.0.1',
                          'broadcast': None,
                          'label': 'lo',
                          'netmask': '255.0.0.0'}],
                'inet6': [{'address': '::1', 'prefixlen': '128'}],
                'up': True}}

    :param conn: A connection object to a remote node

def linux_interfaces(conn):
    """
    Obtain interface information for *NIX/BSD variants in remote servers.

    Example output from a remote node with a couple of interfaces::

        {'eth0': {'hwaddr': '08:00:27:08:c2:e4',
                  'inet': [{'address': '10.0.2.15',
                            'broadcast': '10.0.2.255',
                            'label': 'eth0',
                            'netmask': '255.255.255.0'}],
                  'inet6': [{'address': 'fe80::a00:27ff:fe08:c2e4',
                             'prefixlen': '64'}],
                  'up': True},
         'eth1': {'hwaddr': '08:00:27:70:06:f1',
                  'inet': [{'address': '192.168.111.101',
                            'broadcast': '192.168.111.255',
                            'label': 'eth1',
                            'netmask': '255.255.255.0'}],
                  'inet6': [{'address': 'fe80::a00:27ff:fe70:6f1',
                             'prefixlen': '64'}],
                  'up': True},
         'lo': {'hwaddr': '00:00:00:00:00:00',
                'inet': [{'address': '127.0.0.1',
                          'broadcast': None,
                          'label': 'lo',
                          'netmask': '255.0.0.0'}],
                'inet6': [{'address': '::1', 'prefixlen': '128'}],
                'up': True}}

    :param conn: A connection object to a remote node
    """
    ifaces = dict()
    ip_path = conn.remote_module.which('ip')
    ifconfig_path = None if ip_path else conn.remote_module.which('ifconfig')
    if ip_path:
        cmd1, _, _ = remoto.process.check(
            conn,
            [
                '{0}'.format(ip_path),
                'link',
                'show',
            ],
        )
        cmd2, _, _ = remoto.process.check(
            conn,
            [
                '{0}'.format(ip_path),
                'addr',
                'show',
            ],
        )
        ifaces = _interfaces_ip(b'\n'.join(cmd1).decode('utf-8') + '\n' +
                                b'\n'.join(cmd2).decode('utf-8'))
    elif ifconfig_path:
        cmd, _, _ = remoto.process.check(
            conn,
            [
                '{0}'.format(ifconfig_path),
                '-a',
            ]
        )
        ifaces = _interfaces_ifconfig('\n'.join(cmd))
    return ifaces