Return the targets from the flat yaml file, checks opts for location but
    defaults to /etc/salt/roster

def targets(tgt, tgt_type='glob', **kwargs):  # pylint: disable=W0613
    '''
    Return the targets from the flat yaml file, checks opts for location but
    defaults to /etc/salt/roster
    '''
    ret = {}

    cloud_opts = salt.config.cloud_config(
        os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud')
    )

    minions = __runner__['cache.cloud'](tgt)
    for minion_id, full_info in minions.items():
        profile, provider = full_info.get('profile', None), full_info.get('provider', None)
        vm_ = {
            'driver': provider,
            'profile': profile,
        }
        public_ips = full_info.get('public_ips', [])
        private_ips = full_info.get('private_ips', [])
        ip_list = []
        for item in (public_ips, private_ips):
            if isinstance(item, list):
                ip_list = ip_list + item
            elif isinstance(item, string_types):
                ip_list.append(item)

        roster_order = __opts__.get('roster_order', (
            'public', 'private', 'local'
        ))
        preferred_ip = extract_ipv4(roster_order, ip_list)

        ret[minion_id] = copy.deepcopy(__opts__.get('roster_defaults', {}))
        ret[minion_id].update({'host': preferred_ip})

        ssh_username = salt.utils.cloud.ssh_usernames(vm_, cloud_opts)
        if isinstance(ssh_username, string_types):
            ret[minion_id]['user'] = ssh_username
        elif isinstance(ssh_username, list):
            if ssh_username[0] != 'root':
                ret[minion_id]['user'] = ssh_username[0]

        password = salt.config.get_cloud_config_value(
            'ssh_password', vm_, cloud_opts, search_global=False, default=None
        )
        if password:
            ret[minion_id]['password'] = password

        key_filename = salt.config.get_cloud_config_value(
            'private_key', vm_, cloud_opts, search_global=False, default=None
        )
        if key_filename:
            ret[minion_id]['priv'] = key_filename

        sudo = salt.config.get_cloud_config_value(
            'sudo', vm_, cloud_opts, search_global=False, default=None
        )
        if sudo:
            ret[minion_id]['sudo'] = sudo

    return ret