summaryrefslogtreecommitdiffstats
path: root/ansible_collections/community/vmware/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'ansible_collections/community/vmware/plugins')
-rw-r--r--ansible_collections/community/vmware/plugins/module_utils/vmware.py8
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_cluster_dpm.py2
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_cluster_info.py2
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_datacenter_info.py2
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_datastore_info.py1
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_dvs_portgroup.py7
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_info.py1
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py1
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_host_facts.py1
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_vcenter_settings_info.py2
-rw-r--r--ansible_collections/community/vmware/plugins/modules/vmware_vsan_health_info.py5
11 files changed, 8 insertions, 24 deletions
diff --git a/ansible_collections/community/vmware/plugins/module_utils/vmware.py b/ansible_collections/community/vmware/plugins/module_utils/vmware.py
index 12bdf5107..c2c9a4f23 100644
--- a/ansible_collections/community/vmware/plugins/module_utils/vmware.py
+++ b/ansible_collections/community/vmware/plugins/module_utils/vmware.py
@@ -39,11 +39,9 @@ try:
from pyVim import connect
from pyVmomi import vim, vmodl, VmomiSupport
HAS_PYVMOMI = True
- HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')
except ImportError:
PYVMOMI_IMP_ERR = traceback.format_exc()
HAS_PYVMOMI = False
- HAS_PYVMOMIJSON = False
from ansible.module_utils._text import to_text, to_native
from ansible.module_utils.six import integer_types, iteritems, string_types, raise_from
@@ -1972,9 +1970,6 @@ class PyVmomi(object):
provided then all properties are deeply converted. The resulting
JSON is sorted to improve human readability.
- Requires upstream support from pyVmomi > 6.7.1
- (https://github.com/vmware/pyvmomi/pull/732)
-
Args:
- obj (object): vim object
- properties (list, optional): list of properties following
@@ -1985,9 +1980,6 @@ class PyVmomi(object):
Return:
dict
"""
- if not HAS_PYVMOMIJSON:
- self.module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')
-
result = dict()
if properties:
for prop in properties:
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_cluster_dpm.py b/ansible_collections/community/vmware/plugins/modules/vmware_cluster_dpm.py
index 1215f52c3..5a63baea8 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_cluster_dpm.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_cluster_dpm.py
@@ -117,7 +117,7 @@ class VMwareCluster(PyVmomi):
change_message = None
changes = False
- if dpm_config.enabled != self.enable_dpm:
+ if dpm_config is None or dpm_config.enabled != self.enable_dpm:
change_message = 'DPM enabled status changes'
changes = True
return changes, change_message
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_cluster_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_cluster_info.py
index 24ca77bc8..273f7a351 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_cluster_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_cluster_info.py
@@ -42,7 +42,7 @@ options:
description:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module.
- - The V(vsphere) output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
+ - The V(vsphere) output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_datacenter_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_datacenter_info.py
index 3b8dfc878..2d5ef8729 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_datacenter_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_datacenter_info.py
@@ -29,7 +29,7 @@ options:
description:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module.
- - The V(vsphere) output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
+ - The V(vsphere) output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_datastore_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_datastore_info.py
index 4c3fdc1e1..618e929c9 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_datastore_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_datastore_info.py
@@ -58,7 +58,6 @@ options:
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module
- The 'vsphere' output schema is the vSphere API class definition
- which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_dvs_portgroup.py b/ansible_collections/community/vmware/plugins/modules/vmware_dvs_portgroup.py
index a7b09d0c7..fbe790be6 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_dvs_portgroup.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_dvs_portgroup.py
@@ -64,11 +64,12 @@ options:
state:
description:
- Determines if the portgroup should be present or not.
- required: true
+ required: false
type: str
choices:
- 'present'
- 'absent'
+ default: 'present'
vlan_trunk:
description:
- Indicates whether this is a VLAN trunk or not.
@@ -734,7 +735,7 @@ class VMwareDvsPortgroup(PyVmomi):
# Check config
if self.module.params['port_allocation'] != 'elastic' and self.module.params['port_binding'] != 'ephemeral':
- if self.dvs_portgroup.config.numPorts != self.module.params['num_ports']:
+ if self.module.params['num_ports'] is not None and self.dvs_portgroup.config.numPorts != self.module.params['num_ports']:
return 'update'
# Default port config
@@ -893,7 +894,7 @@ def main():
num_ports=dict(type='int'),
port_binding=dict(required=True, type='str', choices=['static', 'ephemeral']),
port_allocation=dict(type='str', choices=['fixed', 'elastic']),
- state=dict(required=True, choices=['present', 'absent'], type='str'),
+ state=dict(type='str', choices=['present', 'absent'], default='present'),
vlan_trunk=dict(type='bool', default=False),
vlan_private=dict(type='bool', default=False),
network_policy=dict(
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_info.py
index b4fa9c7c3..7e3a3b082 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_dvswitch_info.py
@@ -43,7 +43,6 @@ options:
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module
- The 'vsphere' output schema is the vSphere API class definition
- which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py
index 470f76642..4f3678e37 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_guest_info.py
@@ -87,7 +87,6 @@ options:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module
- The V(vsphere) output schema is the vSphere API class definition
- which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_host_facts.py b/ansible_collections/community/vmware/plugins/modules/vmware_host_facts.py
index a4738b117..1bfd64012 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_host_facts.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_host_facts.py
@@ -47,7 +47,6 @@ options:
- Specify the output schema desired.
- The V(summary) output schema is the legacy output from the module
- The V(vsphere) output schema is the vSphere API class definition
- which requires pyvmomi>6.7.1
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_vcenter_settings_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_vcenter_settings_info.py
index 3936cc770..183a58244 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_vcenter_settings_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_vcenter_settings_info.py
@@ -22,7 +22,7 @@ options:
description:
- Specify the output schema desired.
- The 'summary' output schema is the legacy output from the module.
- - The 'vsphere' output schema is the vSphere API class definition which requires pyvmomi>6.7.1.
+ - The 'vsphere' output schema is the vSphere API class definition.
choices: ['summary', 'vsphere']
default: 'summary'
type: str
diff --git a/ansible_collections/community/vmware/plugins/modules/vmware_vsan_health_info.py b/ansible_collections/community/vmware/plugins/modules/vmware_vsan_health_info.py
index 565b2b859..7a6b68735 100644
--- a/ansible_collections/community/vmware/plugins/modules/vmware_vsan_health_info.py
+++ b/ansible_collections/community/vmware/plugins/modules/vmware_vsan_health_info.py
@@ -108,11 +108,9 @@ import traceback
try:
from pyVmomi import vmodl, VmomiSupport
HAS_PYVMOMI = True
- HAS_PYVMOMIJSON = hasattr(VmomiSupport, 'VmomiJSONEncoder')
except ImportError:
PYVMOMI_IMP_ERR = traceback.format_exc()
HAS_PYVMOMI = False
- HAS_PYVMOMIJSON = False
VSANPYTHONSDK_IMP_ERR = None
try:
@@ -186,9 +184,6 @@ def main():
if not HAS_VSANPYTHONSDK:
module.fail_json(msg=missing_required_lib('vSAN Management SDK for Python'), exception=VSANPYTHONSDK_IMP_ERR)
- if not HAS_PYVMOMIJSON:
- module.fail_json(msg='The installed version of pyvmomi lacks JSON output support; need pyvmomi>6.7.1')
-
vsan_info_manager = VSANInfoManager(module)
vsan_info_manager.gather_info()