|
|
@ -60,6 +60,19 @@ DOCUMENTATION = '''
|
|
|
|
- 'https://code.vmware.com/web/sdk/65/vsphere-automation-python'
|
|
|
|
- 'https://code.vmware.com/web/sdk/65/vsphere-automation-python'
|
|
|
|
default: False
|
|
|
|
default: False
|
|
|
|
type: boolean
|
|
|
|
type: boolean
|
|
|
|
|
|
|
|
properties:
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Specify the list of VMware schema properties associated with the VM.
|
|
|
|
|
|
|
|
- These properties will be populated in hostvars of the given VM.
|
|
|
|
|
|
|
|
- Each value in the list specifies the path to a specific property in VM object.
|
|
|
|
|
|
|
|
type: list
|
|
|
|
|
|
|
|
default: [ 'name', 'config.cpuHotAddEnabled', 'config.cpuHotRemoveEnabled',
|
|
|
|
|
|
|
|
'config.instanceUuid', 'config.hardware.numCPU', 'config.template',
|
|
|
|
|
|
|
|
'config.name', 'guest.hostName', 'guest.ipAddress',
|
|
|
|
|
|
|
|
'guest.guestId', 'guest.guestState', 'runtime.maxMemoryUsage',
|
|
|
|
|
|
|
|
'customValue'
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
version_added: "2.9"
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
|
|
|
EXAMPLES = '''
|
|
|
@ -71,6 +84,18 @@ EXAMPLES = '''
|
|
|
|
password: Esxi@123$%
|
|
|
|
password: Esxi@123$%
|
|
|
|
validate_certs: False
|
|
|
|
validate_certs: False
|
|
|
|
with_tags: True
|
|
|
|
with_tags: True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Gather minimum set of properties for VMware guest
|
|
|
|
|
|
|
|
plugin: vmware_vm_inventory
|
|
|
|
|
|
|
|
strict: False
|
|
|
|
|
|
|
|
hostname: 10.65.223.31
|
|
|
|
|
|
|
|
username: administrator@vsphere.local
|
|
|
|
|
|
|
|
password: Esxi@123$%
|
|
|
|
|
|
|
|
validate_certs: False
|
|
|
|
|
|
|
|
with_tags: False
|
|
|
|
|
|
|
|
properties:
|
|
|
|
|
|
|
|
- 'name'
|
|
|
|
|
|
|
|
- 'guest.ipAddress'
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
|
import ssl
|
|
|
|
import ssl
|
|
|
@ -432,23 +457,8 @@ class InventoryModule(BaseInventoryPlugin, Cacheable):
|
|
|
|
|
|
|
|
|
|
|
|
def _populate_host_properties(self, vm_obj, current_host):
|
|
|
|
def _populate_host_properties(self, vm_obj, current_host):
|
|
|
|
# Load VM properties in host_vars
|
|
|
|
# Load VM properties in host_vars
|
|
|
|
vm_properties = [
|
|
|
|
vm_properties = self.get_option('properties') or []
|
|
|
|
'name',
|
|
|
|
|
|
|
|
'config.cpuHotAddEnabled',
|
|
|
|
|
|
|
|
'config.cpuHotRemoveEnabled',
|
|
|
|
|
|
|
|
'config.instanceUuid',
|
|
|
|
|
|
|
|
'config.hardware.numCPU',
|
|
|
|
|
|
|
|
'config.template',
|
|
|
|
|
|
|
|
'config.name',
|
|
|
|
|
|
|
|
'guest.hostName',
|
|
|
|
|
|
|
|
'guest.ipAddress',
|
|
|
|
|
|
|
|
'guest.guestId',
|
|
|
|
|
|
|
|
'guest.guestState',
|
|
|
|
|
|
|
|
'runtime.maxMemoryUsage',
|
|
|
|
|
|
|
|
'customValue',
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
field_mgr = []
|
|
|
|
|
|
|
|
if self.pyv.content.customFieldsManager:
|
|
|
|
|
|
|
|
field_mgr = self.pyv.content.customFieldsManager.field
|
|
|
|
field_mgr = self.pyv.content.customFieldsManager.field
|
|
|
|
|
|
|
|
|
|
|
|
for vm_prop in vm_properties:
|
|
|
|
for vm_prop in vm_properties:
|
|
|
|