I'm not very familiar with vmware, but I'd ask around and see if you have 
access to the vmware API and see if there is an endpoint on which you could 
send a query for the current host.
I'd assume that the information provided about the host includes which 
vcenter the vm is on.

I've done something like this with GitHub releases.

Example: (Just Tested)

- name: Get Latest Release Number for App
  hosts: localhost

  tasks:
    - name: Get Release Number
      uri:
        url: 
https://api.github.com/repos/BookStackApp/BookStack/releases/latest
        method: GET
        return_content: yes
        body_format: json
      register: latest_release

    - debug:
        var: latest_release.json.tag_name


You'll see if you run that the output shows the tag_name object.

I'd bet you could do something similar to get what you need to put the 
vcenter into a variable so long as this can be pulled from the vmware API.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e7c337f5-cdd8-4dfc-b33b-c55a7cedac2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to