def get_inventory_roles_to_hosts(inventory, roles, fqdn=False):
    """Return a map of roles to host lists, e.g.
         roles_to_hosts['CephStorage'] = ['oc0-ceph-0', 'oc0-ceph-1']
         roles_to_hosts['Controller'] = ['oc0-controller-0']
         roles_to_hosts['Compute'] = ['oc0-compute-0']
    Uses ansible inventory as source
    """
    roles_to_hosts = {}
    for key in inventory:
        if key in roles:
            roles_to_hosts[key] = []
            for host in inventory[key]['hosts']:
                if fqdn:
                    hostname = inventory[key]['hosts'][host]['canonical_hostname']
                else:
                    hostname = host
                roles_to_hosts[key].append(hostname)
    return roles_to_hosts