'Guess the host provider
Returns:
dict: The generated default facts for the detected provider'

def guess_host_provider(self):

    product_name = self.system_facts['ansible_product_name']
    product_version = self.system_facts['ansible_product_version']
    virt_type = self.system_facts['ansible_virtualization_type']
    virt_role = self.system_facts['ansible_virtualization_role']
    bios_vendor = self.system_facts['ansible_system_vendor']
    provider = None
    metadata = None
    if (bios_vendor == 'Google'):
        provider = 'gce'
        metadata_url = 'http://metadata.google.internal/computeMetadata/v1/?recursive=true'
        headers = {'Metadata-Flavor': 'Google'}
        metadata = get_provider_metadata(metadata_url, True, headers, True)
        if metadata:
            metadata['project']['attributes'].pop('sshKeys', None)
            metadata['instance'].pop('serviceAccounts', None)
    elif ((virt_type == 'xen') and (virt_role == 'guest') and re.match('.*\\.amazon$', product_version)):
        provider = 'aws'
        metadata_url = 'http://169.254.169.254/latest/meta-data/'
        metadata = get_provider_metadata(metadata_url)
    elif re.search('OpenStack', product_name):
        provider = 'openstack'
        metadata_url = 'http://169.254.169.254/openstack/latest/meta_data.json'
        metadata = get_provider_metadata(metadata_url, True, None, True)
        if metadata:
            ec2_compat_url = 'http://169.254.169.254/latest/meta-data/'
            metadata['ec2_compat'] = get_provider_metadata(ec2_compat_url)
            metadata.pop('public_keys', None)
            metadata.pop('random_seed', None)
            if (not metadata['ec2_compat']):
                metadata = None
    return dict(name=provider, metadata=metadata)
