From 2af759e9f9dec0dd444bbe0787f3ab903659a79d Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 9 Aug 2017 15:41:30 +0200 Subject: [PATCH] vmware_vm_facts: Improve example and docs (#27898) This fixes ansible/ansible-modules-extras#2475 --- .../modules/cloud/vmware/vmware_vm_facts.py | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/vmware_vm_facts.py b/lib/ansible/modules/cloud/vmware/vmware_vm_facts.py index caad5c2bcc0..2ca76b393e3 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vm_facts.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vm_facts.py @@ -12,31 +12,41 @@ ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: vmware_vm_facts short_description: Return basic facts pertaining to a vSphere virtual machine guest description: - - Return basic facts pertaining to a vSphere virtual machine guest -version_added: 2.0 -author: "Joseph Callen (@jcpowermac)" +- Return basic facts pertaining to a vSphere virtual machine guest. +version_added: '2.0' +author: +- Joseph Callen (@jcpowermac) notes: - - Tested on vSphere 5.5 - - Tested on vSphere 6.5 +- Tested on vSphere 5.5 and vSphere 6.5 requirements: - - "python >= 2.6" - - PyVmomi +- python >= 2.6 +- PyVmomi extends_documentation_fragment: vmware.documentation ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Gather all registered virtual machines - local_action: - module: vmware_vm_facts + vmware_vm_facts: hostname: esxi_or_vcenter_ip_or_hostname username: username password: password + delegate_to: localhost + register: vmfacts + +- debug: + var: vmfacts.virtual_machines +''' + +RETURN = r''' +virtual_machines: + description: dictionary of virtual machines and their facts + returned: success + type: dict ''' try: