'Adds an instance to the inventory and index'

def add_instance(self, hostname, deployment, ssh_port, cloud_service, status):

    dest = urlparse(deployment.url).hostname
    self.index[hostname] = deployment.name
    self.host_metadata[hostname] = dict(ansible_ssh_host=dest, ansible_ssh_port=int(ssh_port), instance_status=status, private_id=deployment.private_id)
    self.push(self.inventory, 'azure', hostname)
    self.push(self.inventory, self.to_safe(cloud_service.service_name), hostname)
    if (int(ssh_port) == 22):
        self.push(self.inventory, 'Cloud_services', hostname)
    self.push(self.inventory, self.to_safe(cloud_service.hosted_service_properties.location), hostname)
