bump collection requirements, vmware patches

New VMWare and azure were released, pick those up

Enable using of VMWare inventory plugin for Ansible 2.9

Few fixes from manual testing with VMWare
  Remove invalid properties which resulted in no hosts imported
  Add some defaults to be more consistent with script
This commit is contained in:
AlanCoding
2020-04-23 10:52:17 -04:00
parent c0e07198cf
commit 8bbd2c7aaa
3 changed files with 14 additions and 10 deletions

View File

@@ -2251,7 +2251,7 @@ class gce(PluginFileInjector):
class vmware(PluginFileInjector): class vmware(PluginFileInjector):
plugin_name = 'vmware_vm_inventory' plugin_name = 'vmware_vm_inventory'
# initial_version = '2.9' # Ready 4/22/2020, waiting for release initial_version = '2.9'
ini_env_reference = 'VMWARE_INI_PATH' ini_env_reference = 'VMWARE_INI_PATH'
base_injector = 'managed' base_injector = 'managed'
namespace = 'community' namespace = 'community'
@@ -2268,9 +2268,6 @@ class vmware(PluginFileInjector):
# Documentation of props, see # Documentation of props, see
# https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/scenario_guides/vmware_scenarios/vmware_inventory_vm_attributes.rst # https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/scenario_guides/vmware_scenarios/vmware_inventory_vm_attributes.rst
UPPERCASE_PROPS = [ UPPERCASE_PROPS = [
"ansible_ssh_host",
"ansible_host",
"ansible_uuid",
"availableField", "availableField",
"configIssue", "configIssue",
"configStatus", "configStatus",
@@ -2343,16 +2340,26 @@ class vmware(PluginFileInjector):
if not striped_hf: if not striped_hf:
continue continue
ret['filters'].append(striped_hf) ret['filters'].append(striped_hf)
else:
# default behavior filters by power state
ret['filters'] = ['runtime.powerState == "poweredOn"']
groupby_patterns = vmware_opts.get('groupby_patterns') groupby_patterns = vmware_opts.get('groupby_patterns')
ret.setdefault('keyed_groups', [])
if groupby_patterns: if groupby_patterns:
ret.setdefault('keyed_groups', [])
for pattern in groupby_patterns.split(','): for pattern in groupby_patterns.split(','):
stripped_pattern = pattern.replace('{', '').replace('}', '').strip() # make best effort stripped_pattern = pattern.replace('{', '').replace('}', '').strip() # make best effort
ret['keyed_groups'].append({ ret['keyed_groups'].append({
'prefix': '', 'separator': '', 'prefix': '', 'separator': '',
'key': stripped_pattern 'key': stripped_pattern
}) })
else:
# default groups from script
for entry in ('guest.guestId', '"templates" if config.template else "guests"'):
ret['keyed_groups'].append({
'prefix': '', 'separator': '',
'key': entry
})
return ret return ret

View File

@@ -25,9 +25,6 @@ keyed_groups:
separator: '' separator: ''
plugin: community.vmware.vmware_vm_inventory plugin: community.vmware.vmware_vm_inventory
properties: properties:
- ansible_ssh_host
- ansible_host
- ansible_uuid
- availableField - availableField
- configIssue - configIssue
- configStatus - configStatus

View File

@@ -3,7 +3,7 @@ collections:
- name: awx.awx - name: awx.awx
version: 9.3.0 version: 9.3.0
- name: azure.azcollection - name: azure.azcollection
version: 0.1.1 # questionable https://github.com/ansible-collections/azure/issues/55 version: 0.1.2
- name: amazon.aws - name: amazon.aws
version: 0.1.1 # version 0.1.0 seems to have gone missing version: 0.1.1 # version 0.1.0 seems to have gone missing
- name: theforeman.foreman - name: theforeman.foreman
@@ -13,6 +13,6 @@ collections:
- name: openstack.cloud - name: openstack.cloud
version: 0.0.1-dev85 # earlier had checksum mismatch version: 0.0.1-dev85 # earlier had checksum mismatch
- name: community.vmware - name: community.vmware
version: 0.3.1-dev1 version: 0.4.0 # first to contain necessary grouping and filtering features
- name: ovirt.ovirt_collection - name: ovirt.ovirt_collection
version: 1.0.1 # new fix published, should be good to go version: 1.0.1 # new fix published, should be good to go