VMware: Add managed object id in VM facts (#53523)

Fixes: #53372

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-05-07 17:05:38 +05:30 committed by GitHub
commit 2007a79952
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 2 deletions

View file

@ -133,6 +133,20 @@ EXAMPLES = '''
properties: ["config.hardware.memoryMB", "guest.disk", "overallStatus"]
delegate_to: localhost
register: facts
- name: Gather Managed object ID (moid) from a guest using the vSphere API output schema for REST Calls
vmware_guest_facts:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter_name }}"
name: "{{ vm_name }}"
schema: "vsphere"
properties:
- _moId
delegate_to: localhost
register: moid_facts
'''
RETURN = """
@ -192,7 +206,9 @@ instance:
"tags": [
"backup"
],
"vnc": {}
"vnc": {},
"moid": "vm-42",
"vimref": "vim.VirtualMachine:vm-42"
}
"""
@ -251,7 +267,6 @@ def main():
instance = pyv.gather_facts(vm)
else:
instance = pyv.to_json(vm, module.params['properties'])
if module.params.get('tags'):
if not HAS_VCLOUD:
module.fail_json(msg="Unable to find 'vCloud Suite SDK' Python library which is required."