From 8c657e210cdca66203f0e24c3920fd284c1a8c55 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 21 Apr 2020 23:00:15 -0400 Subject: [PATCH] VMWare collection ready but waiting for release turn off use of VMWare inventory plugin for now Attempt to roll back general migration to Ansible 2.8 failed, kept at 2.9 because of compatibility --- awx/main/models/inventory.py | 33 ++++++++++--------- .../vmware/files/vmware_vm_inventory.yml | 4 +++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 1930a89ae6..b0e5e6700f 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -2251,7 +2251,7 @@ class gce(PluginFileInjector): class vmware(PluginFileInjector): plugin_name = 'vmware_vm_inventory' - initial_version = '2.9' # Only tested with collection version + # initial_version = '2.9' # Ready 4/22/2020, waiting for release ini_env_reference = 'VMWARE_INI_PATH' base_injector = 'managed' namespace = 'community' @@ -2271,23 +2271,23 @@ class vmware(PluginFileInjector): "ansible_ssh_host", "ansible_host", "ansible_uuid", - "availableField", # optional? - "configIssue", # optional? - "configStatus", # optional? - "customValue", # optional? + "availableField", + "configIssue", + "configStatus", + "customValue", # optional "datastore", - "effectiveRole", # optional? - "guestHeartbeatStatus", # optonal? - "layout", # optional? - "layoutEx", # optional? + "effectiveRole", + "guestHeartbeatStatus", # optonal + "layout", # optional + "layoutEx", # optional "name", "network", - "overallStatus", # optional? - "parentVApp", # optional? + "overallStatus", + "parentVApp", # optional "permission", - "recentTask", # optional? + "recentTask", "resourcePool", - "rootSnapshot", # optional? + "rootSnapshot", "snapshot", # optional "tag", "triggeredAlarmState", @@ -2302,12 +2302,15 @@ class vmware(PluginFileInjector): "summary", # repeat of other properties ] ret['properties'] = UPPERCASE_PROPS + NESTED_PROPS - ret['compose'] = {} + ret['compose'] = {'ansible_host': 'guest.ipAddress'} # default value + ret['compose']['ansible_ssh_host'] = ret['compose']['ansible_host'] + # the ansible_uuid was unique every host, every import, from the script + ret['compose']['ansible_uuid'] = '99999999 | random | to_uuid' for prop in UPPERCASE_PROPS: if prop == prop.lower(): continue ret['compose'][prop.lower()] = prop - # ret['with_nested_properties'] = True # only dacrystal/topic/vmware-inventory-plugin-enhancements + ret['with_nested_properties'] = True # ret['property_name_format'] = 'lower_case' # only dacrystal/topic/vmware-inventory-plugin-property-format # process custom options diff --git a/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml b/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml index 36796f1779..6363d6c26b 100644 --- a/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml +++ b/awx/main/tests/data/inventory/plugins/vmware/files/vmware_vm_inventory.yml @@ -1,4 +1,7 @@ compose: + ansible_host: guest.ipAddress + ansible_ssh_host: guest.ipAddress + ansible_uuid: 99999999 | random | to_uuid availablefield: availableField configissue: configIssue configstatus: configStatus @@ -53,3 +56,4 @@ properties: - storage - summary strict: false +with_nested_properties: true