Vmware was published

implement vmware inventory plugin

Enable the previously broken properties
This commit is contained in:
AlanCoding 2020-03-17 12:51:29 -04:00
parent fcf75af6a7
commit 99ae614a63
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B
2 changed files with 224 additions and 2 deletions

View File

@ -2226,7 +2226,8 @@ class gce(PluginFileInjector):
class vmware(PluginFileInjector):
# plugin_name = 'vmware_vm_inventory' # FIXME: implement me
plugin_name = 'vmware_vm_inventory' # FIXME: implement me
initial_version = '2.10' # Only tested with collection version, TODO: test 2.9 as candidate
ini_env_reference = 'VMWARE_INI_PATH'
base_injector = 'managed'
namespace = 'community'
@ -2236,6 +2237,227 @@ class vmware(PluginFileInjector):
def script_name(self):
return 'vmware_inventory.py' # exception
def inventory_as_dict(self, inventory_update, private_data_dir):
ret = super(vmware, self).inventory_as_dict(inventory_update, private_data_dir)
ret['properties'] = [
"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",
# not in the defaults
"vpmcsupported",
"vpmcenabled",
"vmxconfigchecksum",
"vmstorageobjectid",
"vmnpivwwnupdatesupported",
"vmnpivwwnsupported",
"vmnpivwwndisablesupported",
"vmfsnativesnapshotsupported",
"vm",
"virtualmmuusagesupported",
"virtualmmuusageignored",
"virtualexecusageignored",
"vflashcachereservation",
"vflashcacheallocation",
"version",
"vassertsenabled",
"vappconfig",
"value",
"uuid",
'triggeredalarmstate',
'toolsversionstatus2',
'toolsversionstatus',
'toolsversion',
'toolsupdatestatus',
'toolssynctimesupported',
'toolsstatus',
'toolsrunningstatus',
'toolsrebootpredictsupported',
'toolsinstalltype',
'toolsinstallermounted',
'toolsautoupdatesupported',
'tools',
'timestamp',
'template',
'tag',
'swapstorageobjectid',
'swapplacementsupported',
'swapplacement',
'suspendtime',
'suspendinterval',
'summary', # vim.vm.Summary
'storage', # vim.vm.StorageInfo
'snapshotoperationssupported',
'snapshotinbackground',
'snapshotconfigsupported',
'snapshot',
'settingvideoramsizesupported',
'settingscreenresolutionsupported',
'settingdisplaytopologysupported',
'settingdisplaytopologymodessupported',
'sesparsedisksupported',
'securebootsupported',
'screen',
'scheduledhardwareupgradeinfo',
's1acpimanagementsupported',
'runtime', # vim.vm.RuntimeInfo
'rootsnapshot',
'reverttosnapshotsupported',
'resourcepool',
'repconfig',
'recordreplaysupported',
'recordreplaystate',
'recenttask',
'quiescedsnapshotssupported',
'quiescedforkparent',
'quickstats',
'question',
'powerstate',
'powerpolicy',
'poweredonmonitortypechangesupported',
'poweredoffsnapshotssupported',
'pervmevcsupported',
'permission',
'perdatastoreusage',
'paused',
'parentvapp',
'overallstatus',
'onlinestandby',
'offlinefeaturerequirement',
'nummksconnections',
'npivwwnonnonrdmvmsupported',
'npivworldwidenametype',
'npivtemporarydisabled',
'npivportworldwidename',
'npivonnonrdmdisks',
'npivnodeworldwidename',
'npivdesiredportwwns',
'npivdesirednodewwns',
'networkshaper',
'network', # vim.dvs.DistributedVirtualPortgroup
'net',
'nestedhvsupported',
'nestedhvenabled',
'needsecondaryreason',
'name',
'multiplesnapshotssupported',
'multiplecorespersocketsupported',
'modified',
'minrequiredevcmodekey',
'migrateencryption',
'messagebustunnelenabled',
'messagebussupported',
'memorysnapshotssupported',
'memoryreservationlocksupported',
'memoryreservationlockedtomax',
'memoryoverhead',
'memoryhotaddenabled',
'memoryallocation',
'memoryaffinity',
'maxmksconnections',
'maxmemoryusage',
'maxcpuusage',
'managedby',
'locksnapshotssupported',
'locationid',
'layoutex',
'layout',
'latencysensitivity',
'keyid',
'ipstack',
'ipaddress',
'interactiveguestoperationsready',
'instantclonefrozen',
'instanceuuid',
'initialoverhead',
'hotplugmemorylimit',
'hotplugmemoryincrementsize',
'hostname',
'hostbasedreplicationsupported',
'host',
'hardware',
'gueststatechangesupported',
'gueststate',
'guestoperationsready',
'guestkernelcrashed',
'guestintegrityinfo',
'guestid',
'guestheartbeatstatus',
'guestfullname',
'guestfamily',
'guestautolocksupported',
'guestautolockenabled',
'guest', # Object of type 'vim.vm.GuestInfo' is not JSON serializable
'generationinfo',
'ftinfo',
'forkconfiginfo',
'flags',
'firmware',
'files',
'featurerequirementsupported',
'featurerequirement',
'featuremask',
'faulttolerancestate',
'extraconfig',
'effectiverole',
'dynamictype',
'dynamicproperty',
'disksharessupported',
'diskonlysnapshotonsuspendedvmsupported',
'disk',
'disablesnapshotssupported',
'device',
'defaultpowerops',
'datastoreurl',
'datastore', # some kind of datastore object
'dasvmprotection', # Object of type 'vim.Datastore' is not JSON serializable
'customvalue',
'cryptostate',
'createdate',
'cpuhotremoveenabled',
'cpuhotaddenabled',
'cpufeaturemasksupported',
'cpufeaturemask',
'cpuallocation',
'cpuaffinity',
'runtime.consolidationneeded',
'consolepreferencessupported',
'consolepreferences',
'connectionstate',
'configstatus',
'configissue',
'config', # Object of type 'vim.vm.ConfigInfo' is not JSON serializable
'cleanpoweroff',
'changeversion',
'changetrackingsupported',
'changetrackingenabled',
'capability', # non-python object, bug
'canconnectusbdevices',
'boottime',
'bootretryoptionssupported',
'bootoptionssupported',
'bootoptions',
'availablefield',
'appstate',
'appheartbeatstatus',
'ansible_uuid',
'ansible_ssh_host',
'ansible_host',
'annotation',
'alternateguestname'
]
return ret
def build_script_private_data(self, inventory_update, private_data_dir):
cp = configparser.RawConfigParser()
credential = inventory_update.get_cloud_credential()

View File

@ -9,5 +9,5 @@ collections:
- name: theforeman.foreman # needs inventory plugin published
- name: google.cloud # https://github.com/ansible-collections/ansible_collections_google/pull/167
# - name: openstack.cloud # needs to be published
# - name: community.vmware # not published
- name: community.vmware # needs patch https://github.com/ansible-collections/vmware/pull/58
- name: ovirt.ovirt_collection # new fix published