From e4af85571be579b379b9c65ab2b5549b61dcbc5a Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Wed, 11 Dec 2024 17:21:43 +0100 Subject: [PATCH 1/4] [DNM] Test consolidate argument specs and doc fragments --- .../doc_fragments/additional_rest_options.py | 29 ++++++++ plugins/doc_fragments/base_options.py | 69 ++++++++++++++++++ plugins/module_utils/vmware_argument_spec.py | 72 +++++++++++++++++++ 3 files changed, 170 insertions(+) create mode 100644 plugins/doc_fragments/additional_rest_options.py create mode 100644 plugins/doc_fragments/base_options.py create mode 100644 plugins/module_utils/vmware_argument_spec.py diff --git a/plugins/doc_fragments/additional_rest_options.py b/plugins/doc_fragments/additional_rest_options.py new file mode 100644 index 000000000..263fb011c --- /dev/null +++ b/plugins/doc_fragments/additional_rest_options.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- + +# Copyright: (c) 2016, Charles Paul +# Copyright: (c) 2018, Ansible Project +# Copyright: (c) 2019, Abhijeet Kasurde +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + + +class ModuleDocFragment(object): + # This document fragment serves as a compliment to the vmware.vmware.base documentation fragment for modules + # that use the REST API SDK. You must include the base fragment in addition to this + # + # This vmware.vmware.additional_rest_options fragment will cover any options returned by rest_compatible_argument_spec() + # that are not included in vmware.vmware.base + DOCUMENTATION = r''' +options: + proxy_protocol: + description: + - The proxy connection protocol to use. + - This option is used if the correct proxy protocol cannot be automatically determined. + type: str + choices: [ http, https ] + default: https + aliases: [protocol] +''' diff --git a/plugins/doc_fragments/base_options.py b/plugins/doc_fragments/base_options.py new file mode 100644 index 000000000..dac029963 --- /dev/null +++ b/plugins/doc_fragments/base_options.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +# Copyright: (c) 2016, Charles Paul +# Copyright: (c) 2018, Ansible Project +# Copyright: (c) 2019, Abhijeet Kasurde +# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) +# SPDX-License-Identifier: GPL-3.0-or-later + +from __future__ import absolute_import, division, print_function +__metaclass__ = type + + +class ModuleDocFragment(object): + # This document fragment serves as a base for all vmware modules. If you are using the REST API SDK in your module, + # you should also include the vmware.vmware.additional_rest_options fragment. + # + # This vmware.vmware.base_options fragment covers the arg spec provided by the base_argument_spec() function + DOCUMENTATION = r''' +notes: + - All modules require API write access and hence are not supported on a free ESXi license. + - All variables and VMware object names are case sensitive. + - >- + Modules may rely on the 'requests' python library, which does not use the system certificate store by default. You can + specify the certificate store by setting the REQUESTS_CA_BUNDLE environment variable. + Example: 'export REQUESTS_CA_BUNDLE=/path/to/your/ca_bundle.pem' +options: + hostname: + description: + - The hostname or IP address of the vSphere vCenter server. + - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. + type: str + username: + description: + - The username of the vSphere vCenter server. + - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. + type: str + aliases: [ admin, user ] + password: + description: + - The password of the vSphere vCenter server. + - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. + type: str + aliases: [ pass, pwd ] + validate_certs: + description: + - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. + - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. + type: bool + default: true + port: + description: + - The port number of the vSphere vCenter server. + - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. + type: int + default: 443 + proxy_host: + description: + - The address of a proxy that will receive all HTTPS requests and relay them. + - The format is a hostname or a IP. + - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. + type: str + required: false + proxy_port: + description: + - The port of the HTTP proxy that will receive all HTTPS requests and relay them. + - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. + type: int + required: false +''' diff --git a/plugins/module_utils/vmware_argument_spec.py b/plugins/module_utils/vmware_argument_spec.py new file mode 100644 index 000000000..fd0dcf8ea --- /dev/null +++ b/plugins/module_utils/vmware_argument_spec.py @@ -0,0 +1,72 @@ +from ansible.module_utils.basic import env_fallback + + +def rest_compatible_argument_spec(): + """ + This returns a dictionary that can be used as the baseline for all REST module specs. + If your module uses the REST API SDK, you should use this instead of the base_argument_spec. + If your module uses both the REST API SDK and the pyvmomi SDK, you should still use this spec. + """ + return { + **base_argument_spec(), + **dict( + proxy_protocol=dict( + type='str', + default='https', + choices=['https', 'http'], + aliases=['protocol'] + ), + ) + } + + +def base_argument_spec(): + """ + This returns a dictionary that can be used as the baseline for all VMware module specs. Any arguments + common to both the REST API SDK and pyvmomi SDK should be placed here. + If your module uses the REST API, you should use the rest_compatible_argument_spec since that + includes additional arguments specific to that SDK. + """ + return dict( + hostname=dict( + type='str', + required=False, + fallback=(env_fallback, ['VMWARE_HOST']), + ), + username=dict( + type='str', + aliases=['user', 'admin'], + required=False, + fallback=(env_fallback, ['VMWARE_USER']) + ), + password=dict( + type='str', + aliases=['pass', 'pwd'], + required=False, + no_log=True, + fallback=(env_fallback, ['VMWARE_PASSWORD']) + ), + port=dict( + type='int', + default=443, + fallback=(env_fallback, ['VMWARE_PORT']) + ), + validate_certs=dict( + type='bool', + required=False, + default=True, + fallback=(env_fallback, ['VMWARE_VALIDATE_CERTS']) + ), + proxy_host=dict( + type='str', + required=False, + default=None, + fallback=(env_fallback, ['VMWARE_PROXY_HOST']) + ), + proxy_port=dict( + type='int', + required=False, + default=None, + fallback=(env_fallback, ['VMWARE_PROXY_PORT']) + ), + ) From 33a8afe555b553a8a616a0a7a8168ec9debb4b34 Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Sun, 15 Dec 2024 15:26:01 +0100 Subject: [PATCH 2/4] Next batch of changes --- plugins/module_utils/vmware.py | 36 +------------------ .../modules/vcenter_domain_user_group_info.py | 7 ++-- plugins/modules/vcenter_extension.py | 7 ++-- plugins/modules/vcenter_extension_info.py | 7 ++-- plugins/modules/vcenter_folder.py | 7 ++-- plugins/modules/vcenter_license.py | 5 +-- .../vcenter_root_password_expiration.py | 6 ++-- .../modules/vcenter_standard_key_provider.py | 7 ++-- plugins/modules/vmware_about_info.py | 7 ++-- plugins/modules/vmware_all_snapshots_info.py | 6 ++-- plugins/modules/vmware_cfg_backup.py | 7 ++-- plugins/modules/vmware_cluster.py | 6 ++-- plugins/modules/vmware_cluster_dpm.py | 6 ++-- plugins/modules/vmware_cluster_drs.py | 6 ++-- .../vmware_cluster_drs_recommendations.py | 6 ++-- plugins/modules/vmware_cluster_ha.py | 6 ++-- plugins/modules/vmware_cluster_info.py | 7 ++-- plugins/modules/vmware_cluster_vcls.py | 6 ++-- plugins/modules/vmware_cluster_vsan.py | 6 ++-- plugins/modules/vmware_custom_attribute.py | 7 ++-- .../vmware_custom_attribute_manager.py | 7 ++-- plugins/modules/vmware_datacenter.py | 7 ++-- plugins/modules/vmware_datacenter_info.py | 7 ++-- plugins/modules/vmware_datastore.py | 6 ++-- plugins/modules/vmware_datastore_cluster.py | 7 ++-- .../vmware_datastore_cluster_manager.py | 7 ++-- plugins/modules/vmware_datastore_info.py | 6 ++-- .../vmware_datastore_maintenancemode.py | 6 ++-- plugins/modules/vmware_deploy_ovf.py | 6 ++-- plugins/modules/vmware_drs_group.py | 6 ++-- plugins/modules/vmware_drs_group_info.py | 7 ++-- plugins/modules/vmware_drs_group_manager.py | 6 ++-- plugins/modules/vmware_drs_override.py | 7 ++-- plugins/modules/vmware_drs_rule_info.py | 7 ++-- plugins/modules/vmware_dvs_host.py | 6 ++-- plugins/modules/vmware_dvs_portgroup.py | 6 ++-- plugins/modules/vmware_dvs_portgroup_find.py | 6 ++-- plugins/modules/vmware_dvs_portgroup_info.py | 6 ++-- plugins/modules/vmware_dvswitch.py | 7 ++-- plugins/modules/vmware_dvswitch_info.py | 7 ++-- plugins/modules/vmware_dvswitch_lacp.py | 7 ++-- plugins/modules/vmware_dvswitch_nioc.py | 6 ++-- plugins/modules/vmware_dvswitch_pvlans.py | 7 ++-- plugins/modules/vmware_dvswitch_uplink_pg.py | 7 ++-- plugins/modules/vmware_evc_mode.py | 6 ++-- plugins/modules/vmware_export_ovf.py | 7 ++-- plugins/modules/vmware_first_class_disk.py | 5 +-- .../modules/vmware_first_class_disk_info.py | 5 +-- plugins/modules/vmware_folder_info.py | 7 ++-- plugins/modules/vmware_guest.py | 6 ++-- plugins/modules/vmware_guest_boot_info.py | 7 ++-- plugins/modules/vmware_guest_boot_manager.py | 7 ++-- plugins/modules/vmware_guest_controller.py | 7 ++-- .../modules/vmware_guest_cross_vc_clone.py | 6 ++-- .../vmware_guest_custom_attribute_defs.py | 7 ++-- .../modules/vmware_guest_custom_attributes.py | 7 ++-- .../vmware_guest_customization_info.py | 7 ++-- plugins/modules/vmware_guest_disk.py | 7 ++-- plugins/modules/vmware_guest_disk_info.py | 7 ++-- .../modules/vmware_guest_file_operation.py | 7 ++-- plugins/modules/vmware_guest_find.py | 7 ++-- plugins/modules/vmware_guest_info.py | 7 ++-- plugins/modules/vmware_guest_instant_clone.py | 6 ++-- plugins/modules/vmware_guest_move.py | 7 ++-- plugins/modules/vmware_guest_network.py | 7 ++-- plugins/modules/vmware_guest_powerstate.py | 7 ++-- .../vmware_guest_register_operation.py | 7 ++-- plugins/modules/vmware_guest_screenshot.py | 7 ++-- plugins/modules/vmware_guest_sendkey.py | 7 ++-- plugins/modules/vmware_guest_serial_port.py | 7 ++-- plugins/modules/vmware_guest_snapshot.py | 7 ++-- plugins/modules/vmware_guest_snapshot_info.py | 7 ++-- .../modules/vmware_guest_storage_policy.py | 7 ++-- plugins/modules/vmware_guest_tools_info.py | 7 ++-- plugins/modules/vmware_guest_tools_upgrade.py | 7 ++-- plugins/modules/vmware_guest_tools_wait.py | 7 ++-- plugins/modules/vmware_guest_tpm.py | 7 ++-- plugins/modules/vmware_guest_vgpu.py | 6 ++-- plugins/modules/vmware_guest_vgpu_info.py | 6 ++-- plugins/modules/vmware_guest_video.py | 7 ++-- plugins/modules/vmware_host.py | 7 ++-- plugins/modules/vmware_host_acceptance.py | 7 ++-- .../modules/vmware_host_acceptance_info.py | 7 ++-- .../modules/vmware_host_active_directory.py | 7 ++-- plugins/modules/vmware_host_auto_start.py | 7 ++-- .../modules/vmware_host_capability_info.py | 7 ++-- plugins/modules/vmware_host_config_info.py | 7 ++-- plugins/modules/vmware_host_config_manager.py | 7 ++-- .../modules/vmware_host_custom_attributes.py | 7 ++-- plugins/modules/vmware_host_datastore.py | 7 ++-- plugins/modules/vmware_host_disk_info.py | 7 ++-- plugins/modules/vmware_host_dns.py | 7 ++-- plugins/modules/vmware_host_dns_info.py | 7 ++-- plugins/modules/vmware_host_facts.py | 6 ++-- plugins/modules/vmware_host_feature_info.py | 7 ++-- plugins/modules/vmware_host_firewall_info.py | 7 ++-- .../modules/vmware_host_firewall_manager.py | 7 ++-- plugins/modules/vmware_host_graphics.py | 7 ++-- plugins/modules/vmware_host_hyperthreading.py | 7 ++-- plugins/modules/vmware_host_ipv6.py | 7 ++-- plugins/modules/vmware_host_iscsi.py | 7 ++-- plugins/modules/vmware_host_iscsi_info.py | 7 ++-- plugins/modules/vmware_host_kernel_manager.py | 7 ++-- plugins/modules/vmware_host_lockdown.py | 7 ++-- .../vmware_host_lockdown_exceptions.py | 7 ++-- plugins/modules/vmware_host_logbundle.py | 7 ++-- plugins/modules/vmware_host_logbundle_info.py | 7 ++-- plugins/modules/vmware_host_ntp.py | 7 ++-- plugins/modules/vmware_host_ntp_info.py | 7 ++-- plugins/modules/vmware_host_package_info.py | 7 ++-- plugins/modules/vmware_host_passthrough.py | 7 ++-- .../modules/vmware_host_powermgmt_policy.py | 7 ++-- plugins/modules/vmware_host_powerstate.py | 7 ++-- plugins/modules/vmware_host_scanhba.py | 7 ++-- plugins/modules/vmware_host_scsidisk_info.py | 7 ++-- plugins/modules/vmware_host_service_info.py | 7 ++-- .../modules/vmware_host_service_manager.py | 7 ++-- plugins/modules/vmware_host_snmp.py | 7 ++-- plugins/modules/vmware_host_sriov.py | 7 ++-- plugins/modules/vmware_host_ssl_info.py | 7 ++-- plugins/modules/vmware_host_tcpip_stacks.py | 7 ++-- plugins/modules/vmware_host_user_manager.py | 7 ++-- plugins/modules/vmware_host_vmhba_info.py | 7 ++-- plugins/modules/vmware_host_vmnic_info.py | 7 ++-- plugins/modules/vmware_local_role_info.py | 7 ++-- plugins/modules/vmware_local_role_manager.py | 7 ++-- plugins/modules/vmware_local_user_info.py | 7 ++-- plugins/modules/vmware_local_user_manager.py | 7 ++-- plugins/modules/vmware_maintenancemode.py | 7 ++-- plugins/modules/vmware_migrate_vmk.py | 7 ++-- .../vmware_object_custom_attributes_info.py | 7 ++-- .../modules/vmware_object_role_permission.py | 7 ++-- .../vmware_object_role_permission_info.py | 6 ++-- plugins/modules/vmware_portgroup.py | 7 ++-- plugins/modules/vmware_portgroup_info.py | 7 ++-- .../modules/vmware_recommended_datastore.py | 6 ++-- plugins/modules/vmware_resource_pool.py | 7 ++-- plugins/modules/vmware_resource_pool_info.py | 7 ++-- .../modules/vmware_sdrs_vm_overrides_info.py | 6 ++-- .../modules/vmware_target_canonical_info.py | 7 ++-- plugins/modules/vmware_vasa.py | 6 ++-- plugins/modules/vmware_vasa_info.py | 6 ++-- plugins/modules/vmware_vcenter_settings.py | 7 ++-- .../modules/vmware_vcenter_settings_info.py | 6 ++-- plugins/modules/vmware_vcenter_statistics.py | 7 ++-- plugins/modules/vmware_vm_config_option.py | 7 ++-- plugins/modules/vmware_vm_host_drs_rule.py | 7 ++-- plugins/modules/vmware_vm_info.py | 7 ++-- plugins/modules/vmware_vm_shell.py | 8 ++--- plugins/modules/vmware_vm_storage_policy.py | 6 ++-- .../modules/vmware_vm_storage_policy_info.py | 6 ++-- plugins/modules/vmware_vm_vm_drs_rule.py | 7 ++-- plugins/modules/vmware_vm_vss_dvs_migrate.py | 7 ++-- plugins/modules/vmware_vmkernel.py | 7 ++-- plugins/modules/vmware_vmkernel_info.py | 7 ++-- plugins/modules/vmware_vmotion.py | 7 ++-- plugins/modules/vmware_vsan_cluster.py | 7 ++-- plugins/modules/vmware_vsan_hcl_db.py | 7 ++-- plugins/modules/vmware_vsan_health_info.py | 7 ++-- .../modules/vmware_vsan_release_catalog.py | 7 ++-- plugins/modules/vmware_vspan_session.py | 7 ++-- plugins/modules/vmware_vswitch.py | 7 ++-- plugins/modules/vmware_vswitch_info.py | 7 ++-- plugins/modules/vsan_health_silent_checks.py | 7 ++-- plugins/modules/vsphere_copy.py | 6 ++-- plugins/modules/vsphere_file.py | 6 ++-- 166 files changed, 621 insertions(+), 528 deletions(-) diff --git a/plugins/module_utils/vmware.py b/plugins/module_utils/vmware.py index 9d545204f..51b4cb5a8 100644 --- a/plugins/module_utils/vmware.py +++ b/plugins/module_utils/vmware.py @@ -45,7 +45,7 @@ from ansible.module_utils._text import to_text, to_native from ansible.module_utils.six import integer_types, iteritems, string_types, raise_from -from ansible.module_utils.basic import env_fallback, missing_required_lib +from ansible.module_utils.basic import missing_required_lib from ansible.module_utils.six.moves.urllib.parse import unquote @@ -673,40 +673,6 @@ def get_vnc_extraconfig(vm): return result -def vmware_argument_spec(): - return dict( - hostname=dict(type='str', - required=False, - fallback=(env_fallback, ['VMWARE_HOST']), - ), - username=dict(type='str', - aliases=['user', 'admin'], - required=False, - fallback=(env_fallback, ['VMWARE_USER'])), - password=dict(type='str', - aliases=['pass', 'pwd'], - required=False, - no_log=True, - fallback=(env_fallback, ['VMWARE_PASSWORD'])), - port=dict(type='int', - default=443, - fallback=(env_fallback, ['VMWARE_PORT'])), - validate_certs=dict(type='bool', - required=False, - default=True, - fallback=(env_fallback, ['VMWARE_VALIDATE_CERTS']) - ), - proxy_host=dict(type='str', - required=False, - default=None, - fallback=(env_fallback, ['VMWARE_PROXY_HOST'])), - proxy_port=dict(type='int', - required=False, - default=None, - fallback=(env_fallback, ['VMWARE_PROXY_PORT'])), - ) - - def connect_to_api(module, disconnect_atexit=True, return_si=False, hostname=None, username=None, password=None, port=None, validate_certs=None, httpProxyHost=None, httpProxyPort=None): if module: diff --git a/plugins/modules/vcenter_domain_user_group_info.py b/plugins/modules/vcenter_domain_user_group_info.py index 9992f00cc..29e8799b7 100644 --- a/plugins/modules/vcenter_domain_user_group_info.py +++ b/plugins/modules/vcenter_domain_user_group_info.py @@ -51,7 +51,7 @@ type: bool default: true extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -121,7 +121,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VcenterDomainUserGroupInfo(PyVmomi): @@ -169,7 +170,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( domain=dict(type='str', default='vsphere.local'), search_string=dict(type='str', required=True), diff --git a/plugins/modules/vcenter_extension.py b/plugins/modules/vcenter_extension.py index f877d6bfb..018c4fec3 100644 --- a/plugins/modules/vcenter_extension.py +++ b/plugins/modules/vcenter_extension.py @@ -74,7 +74,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -124,11 +124,12 @@ import datetime from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import connect_to_api, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import connect_to_api +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( extension_key=dict(type='str', required=True, no_log=False), version=dict(type='str', required=True), diff --git a/plugins/modules/vcenter_extension_info.py b/plugins/modules/vcenter_extension_info.py index 222cfb4ea..b603a5f88 100644 --- a/plugins/modules/vcenter_extension_info.py +++ b/plugins/modules/vcenter_extension_info.py @@ -18,7 +18,7 @@ author: - Abhijeet Kasurde (@Akasurde) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -62,7 +62,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareExtManager(PyVmomi): @@ -92,7 +93,7 @@ def gather_plugin_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule( argument_spec=argument_spec, diff --git a/plugins/modules/vcenter_folder.py b/plugins/modules/vcenter_folder.py index 448ad0640..6d5202d60 100644 --- a/plugins/modules/vcenter_folder.py +++ b/plugins/modules/vcenter_folder.py @@ -62,7 +62,7 @@ choices: [ present, absent ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -136,7 +136,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, find_datacenter_by_name, wait_for_task, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, wait_for_task, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -329,7 +330,7 @@ def get_folder(self, folder_name, folder_type, parent_folder=None, recurse=False def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', required=True, aliases=['datacenter_name']), folder_name=dict(type='str', required=True), diff --git a/plugins/modules/vcenter_license.py b/plugins/modules/vcenter_license.py index c7e09d3e5..97454caca 100644 --- a/plugins/modules/vcenter_license.py +++ b/plugins/modules/vcenter_license.py @@ -121,7 +121,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_hostsystem_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_hostsystem_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VcenterLicenseMgr(PyVmomi): @@ -145,7 +146,7 @@ def list_keys(self, licenses): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( labels=dict(type='dict', default=dict(source='ansible')), license=dict(type='str', required=True), diff --git a/plugins/modules/vcenter_root_password_expiration.py b/plugins/modules/vcenter_root_password_expiration.py index 7becddfe7..65f352bc9 100644 --- a/plugins/modules/vcenter_root_password_expiration.py +++ b/plugins/modules/vcenter_root_password_expiration.py @@ -43,7 +43,7 @@ type: int required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -68,7 +68,7 @@ delegate_to: localhost ''' -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -126,7 +126,7 @@ def configure_root_account_password_policy(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( state=dict(default='present', diff --git a/plugins/modules/vcenter_standard_key_provider.py b/plugins/modules/vcenter_standard_key_provider.py index bf0096620..530f6cd1f 100644 --- a/plugins/modules/vcenter_standard_key_provider.py +++ b/plugins/modules/vcenter_standard_key_provider.py @@ -107,7 +107,7 @@ description: The absolute file path of KMS signed CSR downloaded from O(make_kms_trust_vc.download_client_csr). type: path extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -189,7 +189,8 @@ import os from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -638,7 +639,7 @@ def key_provider_operation(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str', required=True), kms_info=dict( diff --git a/plugins/modules/vmware_about_info.py b/plugins/modules/vmware_about_info.py index 2c92ec926..386538d1a 100644 --- a/plugins/modules/vmware_about_info.py +++ b/plugins/modules/vmware_about_info.py @@ -18,7 +18,7 @@ author: - Abhijeet Kasurde (@Akasurde) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -66,7 +66,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareAboutManager(PyVmomi): @@ -102,7 +103,7 @@ def gather_about_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule( argument_spec=argument_spec, diff --git a/plugins/modules/vmware_all_snapshots_info.py b/plugins/modules/vmware_all_snapshots_info.py index e52f830c2..0c4c36391 100644 --- a/plugins/modules/vmware_all_snapshots_info.py +++ b/plugins/modules/vmware_all_snapshots_info.py @@ -44,7 +44,7 @@ choices: ['exact', 'includes'] default: exact extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -125,9 +125,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, list_snapshots_recursively, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim @@ -185,7 +185,7 @@ def passes_filters(self, snapshot_info, filters, match_type): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(required=True, type="str"), filters=dict(required=False, type="dict", default={}), diff --git a/plugins/modules/vmware_cfg_backup.py b/plugins/modules/vmware_cfg_backup.py index 60a680641..fbfe3c4dc 100644 --- a/plugins/modules/vmware_cfg_backup.py +++ b/plugins/modules/vmware_cfg_backup.py @@ -46,7 +46,7 @@ type: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -85,7 +85,8 @@ except ImportError: pass -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, get_all_objs, wait_for_task, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import get_all_objs, wait_for_task, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import open_url from ansible.module_utils.six.moves.urllib.error import HTTPError @@ -213,7 +214,7 @@ def exit_maintenance(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(dest=dict(required=False, type='path'), esxi_hostname=dict(required=False, type='str'), src=dict(required=False, type='path'), diff --git a/plugins/modules/vmware_cluster.py b/plugins/modules/vmware_cluster.py index 45ec4272e..2bba8c081 100644 --- a/plugins/modules/vmware_cluster.py +++ b/plugins/modules/vmware_cluster.py @@ -47,7 +47,7 @@ - module: community.vmware.vmware_cluster_ha - module: community.vmware.vmware_cluster_vsan extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -84,8 +84,8 @@ from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, find_datacenter_by_name, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -199,7 +199,7 @@ def check_cluster_configuration(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_dpm.py b/plugins/modules/vmware_cluster_dpm.py index d976b131c..edb647203 100644 --- a/plugins/modules/vmware_cluster_dpm.py +++ b/plugins/modules/vmware_cluster_dpm.py @@ -54,7 +54,7 @@ default: 3 choices: [1, 2, 3, 4, 5] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -86,9 +86,9 @@ PyVmomi, TaskError, find_datacenter_by_name, - vmware_argument_spec, wait_for_task ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -167,7 +167,7 @@ def configure_dpm(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_drs.py b/plugins/modules/vmware_cluster_drs.py index 354801d36..544c32d6a 100644 --- a/plugins/modules/vmware_cluster_drs.py +++ b/plugins/modules/vmware_cluster_drs.py @@ -77,7 +77,7 @@ type: bool default: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -126,10 +126,10 @@ PyVmomi, TaskError, find_datacenter_by_name, - vmware_argument_spec, wait_for_task, option_diff, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -215,7 +215,7 @@ def configure_drs(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_drs_recommendations.py b/plugins/modules/vmware_cluster_drs_recommendations.py index c9a131ff5..b66371cdd 100644 --- a/plugins/modules/vmware_cluster_drs_recommendations.py +++ b/plugins/modules/vmware_cluster_drs_recommendations.py @@ -35,7 +35,7 @@ required: true aliases: [ datacenter_name ] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -64,8 +64,8 @@ from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, find_datacenter_by_name, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareCluster(PyVmomi): @@ -104,7 +104,7 @@ def recommendations(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_ha.py b/plugins/modules/vmware_cluster_ha.py index cad1eb519..c11d12638 100644 --- a/plugins/modules/vmware_cluster_ha.py +++ b/plugins/modules/vmware_cluster_ha.py @@ -197,7 +197,7 @@ default: 'warning' choices: [ 'disabled', 'warning', 'restartAggressive' ] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -252,10 +252,10 @@ PyVmomi, TaskError, find_datacenter_by_name, - vmware_argument_spec, wait_for_task, option_diff, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -468,7 +468,7 @@ def configure_ha(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_info.py b/plugins/modules/vmware_cluster_info.py index 18ac7608b..276e89ffb 100644 --- a/plugins/modules/vmware_cluster_info.py +++ b/plugins/modules/vmware_cluster_info.py @@ -63,7 +63,7 @@ type: list elements: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -186,8 +186,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six.moves.urllib.parse import unquote -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_datacenter_by_name, find_cluster_by_name, \ +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, find_cluster_by_name, \ get_parent_datacenter +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -322,7 +323,7 @@ def gather_cluster_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str'), cluster_name=dict(type='str'), diff --git a/plugins/modules/vmware_cluster_vcls.py b/plugins/modules/vmware_cluster_vcls.py index 830ca9a4b..de4bb03b3 100644 --- a/plugins/modules/vmware_cluster_vcls.py +++ b/plugins/modules/vmware_cluster_vcls.py @@ -44,7 +44,7 @@ elements: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -85,9 +85,9 @@ TaskError, find_datacenter_by_name, find_datastore_by_name, - vmware_argument_spec, wait_for_task, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -189,7 +189,7 @@ def configure_vCLS(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_cluster_vsan.py b/plugins/modules/vmware_cluster_vsan.py index 0f4eb9cad..2a64d9a5a 100644 --- a/plugins/modules/vmware_cluster_vsan.py +++ b/plugins/modules/vmware_cluster_vsan.py @@ -72,7 +72,7 @@ type: bool type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -134,8 +134,8 @@ PyVmomi, TaskError, find_datacenter_by_name, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -249,7 +249,7 @@ def configure_vsan(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True), datacenter=dict(type='str', required=True, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_custom_attribute.py b/plugins/modules/vmware_custom_attribute.py index 2d33ba254..77e535d6d 100644 --- a/plugins/modules/vmware_custom_attribute.py +++ b/plugins/modules/vmware_custom_attribute.py @@ -51,7 +51,7 @@ choices: ['present', 'absent'] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -83,7 +83,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim @@ -139,7 +140,7 @@ def add_custom_def(self, field): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( custom_attribute=dict(type='str', no_log=False, required=True), object_type=dict(type='str', required=True, choices=[ diff --git a/plugins/modules/vmware_custom_attribute_manager.py b/plugins/modules/vmware_custom_attribute_manager.py index 0eef52182..2db2a57a9 100644 --- a/plugins/modules/vmware_custom_attribute_manager.py +++ b/plugins/modules/vmware_custom_attribute_manager.py @@ -65,7 +65,7 @@ choices: ['present', 'absent'] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -121,7 +121,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class CustomAttributeManager(PyVmomi): @@ -195,7 +196,7 @@ def remove_custom_attributes(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( custom_attributes=dict( type='list', diff --git a/plugins/modules/vmware_datacenter.py b/plugins/modules/vmware_datacenter.py index 8978b5999..4221dd1f5 100644 --- a/plugins/modules/vmware_datacenter.py +++ b/plugins/modules/vmware_datacenter.py @@ -32,7 +32,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -66,7 +66,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -146,7 +147,7 @@ def destroy_datacenter(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_datacenter_info.py b/plugins/modules/vmware_datacenter_info.py index 2d5ef8729..f17626c69 100644 --- a/plugins/modules/vmware_datacenter_info.py +++ b/plugins/modules/vmware_datacenter_info.py @@ -51,7 +51,7 @@ default: false type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -113,7 +113,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -167,7 +168,7 @@ def get_datacenter_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter=dict(type='str', aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_datastore.py b/plugins/modules/vmware_datastore.py index 9ca1119e8..fd38766f4 100644 --- a/plugins/modules/vmware_datastore.py +++ b/plugins/modules/vmware_datastore.py @@ -57,7 +57,7 @@ type: bool default: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -94,9 +94,9 @@ from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, wait_for_task, TaskError) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDatastore(PyVmomi): @@ -219,7 +219,7 @@ def configure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str', required=True), datacenter=dict(type='str', aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_datastore_cluster.py b/plugins/modules/vmware_datastore_cluster.py index 9922499b4..131c5db43 100644 --- a/plugins/modules/vmware_datastore_cluster.py +++ b/plugins/modules/vmware_datastore_cluster.py @@ -85,7 +85,7 @@ type: bool required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -136,7 +136,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -259,7 +260,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(type='str', required=False, aliases=['datacenter']), diff --git a/plugins/modules/vmware_datastore_cluster_manager.py b/plugins/modules/vmware_datastore_cluster_manager.py index cfd7c0ea9..49234c4dd 100644 --- a/plugins/modules/vmware_datastore_cluster_manager.py +++ b/plugins/modules/vmware_datastore_cluster_manager.py @@ -45,7 +45,7 @@ elements: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -95,7 +95,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -209,7 +210,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(type='str', required=False, aliases=['datacenter']), diff --git a/plugins/modules/vmware_datastore_info.py b/plugins/modules/vmware_datastore_info.py index 618e929c9..f1ac48a68 100644 --- a/plugins/modules/vmware_datastore_info.py +++ b/plugins/modules/vmware_datastore_info.py @@ -83,7 +83,7 @@ required: false elements: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -171,10 +171,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, get_all_objs, find_cluster_by_name, get_parent_datacenter) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -309,7 +309,7 @@ def lookup_datastore_by_cluster(self): def main(): """ Main """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), datacenter=dict(type='str', aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_datastore_maintenancemode.py b/plugins/modules/vmware_datastore_maintenancemode.py index 079bdbeb4..5fe3dbb2d 100644 --- a/plugins/modules/vmware_datastore_maintenancemode.py +++ b/plugins/modules/vmware_datastore_maintenancemode.py @@ -46,7 +46,7 @@ required: false type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -106,10 +106,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, wait_for_task, find_cluster_by_name, get_all_objs) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -190,7 +190,7 @@ def ensure(self): def main(): - spec = vmware_argument_spec() + spec = base_argument_spec() spec.update(dict( datastore=dict(type='str', required=False), cluster_name=dict(type='str', required=False), diff --git a/plugins/modules/vmware_deploy_ovf.py b/plugins/modules/vmware_deploy_ovf.py index da59cda4d..31c8f3c24 100644 --- a/plugins/modules/vmware_deploy_ovf.py +++ b/plugins/modules/vmware_deploy_ovf.py @@ -151,7 +151,7 @@ - This requires vmware-tools (vmtoolsd) to properly work after creation. type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -230,10 +230,10 @@ find_vm_by_name, PyVmomi, gather_vm_facts, - vmware_argument_spec, wait_for_task, wait_for_vm_ip, set_vm_power_state) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from ansible_collections.community.vmware.plugins.module_utils.vmware import vim from pyVmomi import vmodl @@ -812,7 +812,7 @@ def deploy(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update({ 'name': {}, 'datastore': { diff --git a/plugins/modules/vmware_drs_group.py b/plugins/modules/vmware_drs_group.py index ef607072a..8ad9342a0 100644 --- a/plugins/modules/vmware_drs_group.py +++ b/plugins/modules/vmware_drs_group.py @@ -17,7 +17,7 @@ description: - "This module can be used to create VM/Host groups in a given cluster. Creates a vm group if O(vms) is set. Creates a host group if O(hosts) is set." extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options module: vmware_drs_group options: @@ -143,11 +143,11 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, wait_for_task, find_cluster_by_name, find_vm_by_id, find_datacenter_by_name) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrsGroupManager(PyVmomi): @@ -512,7 +512,7 @@ def main(): Main function """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(type='str', default='present', choices=['present', 'absent']), diff --git a/plugins/modules/vmware_drs_group_info.py b/plugins/modules/vmware_drs_group_info.py index ff1e0773a..0ce49a75e 100644 --- a/plugins/modules/vmware_drs_group_info.py +++ b/plugins/modules/vmware_drs_group_info.py @@ -17,7 +17,7 @@ description: - "This module can be used to gather information about DRS VM/HOST groups from the given cluster." extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options module: vmware_drs_group_info options: @@ -111,7 +111,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, find_datacenter_by_name, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrsGroupInfoManager(PyVmomi): @@ -234,7 +235,7 @@ def gather_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', required=False, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_drs_group_manager.py b/plugins/modules/vmware_drs_group_manager.py index 36d41819a..79f423b15 100644 --- a/plugins/modules/vmware_drs_group_manager.py +++ b/plugins/modules/vmware_drs_group_manager.py @@ -20,7 +20,7 @@ description: - The module can be used to add VMs / Hosts to or remove them from a DRS group. extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options options: cluster: description: @@ -156,9 +156,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, wait_for_task, find_vm_by_id) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrsGroupMemberManager(PyVmomi): @@ -480,7 +480,7 @@ def main(): Main function """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(type='str', default='present', choices=['present', 'absent']), datacenter=dict(type='str', required=False, aliases=['datacenter_name']), diff --git a/plugins/modules/vmware_drs_override.py b/plugins/modules/vmware_drs_override.py index 5066c3e6a..8f16c2384 100644 --- a/plugins/modules/vmware_drs_override.py +++ b/plugins/modules/vmware_drs_override.py @@ -24,7 +24,7 @@ default: 'manual' type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: - Sergey Goncharov (@svg1007) ''' @@ -58,7 +58,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, wait_for_task, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import wait_for_task, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrsOverride(PyVmomi): @@ -104,7 +105,7 @@ def set_drs_override(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( vm_name=dict(type='str', required=True), drs_behavior=dict(type='str', choices=['manual', 'partiallyAutomated', 'fullyAutomated'], default='manual') diff --git a/plugins/modules/vmware_drs_rule_info.py b/plugins/modules/vmware_drs_rule_info.py index df7d9a5a9..dd765b963 100644 --- a/plugins/modules/vmware_drs_rule_info.py +++ b/plugins/modules/vmware_drs_rule_info.py @@ -32,7 +32,7 @@ - This is required parameter if O(cluster_name) parameter is not provided. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -107,7 +107,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, find_datacenter_by_name, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_datacenter_by_name, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrsInfoManager(PyVmomi): @@ -232,7 +233,7 @@ def gather_drs_rule_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', required=False), cluster_name=dict(type='str', required=False), diff --git a/plugins/modules/vmware_dvs_host.py b/plugins/modules/vmware_dvs_host.py index 5d4fe27ea..286ed3ee7 100644 --- a/plugins/modules/vmware_dvs_host.py +++ b/plugins/modules/vmware_dvs_host.py @@ -88,7 +88,7 @@ type: list elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -152,8 +152,8 @@ PyVmomi, find_dvs_by_name, find_hostsystem_by_name, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -385,7 +385,7 @@ def check_dvs_host_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( esxi_hostname=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_dvs_portgroup.py b/plugins/modules/vmware_dvs_portgroup.py index feae42c96..b2df7976d 100644 --- a/plugins/modules/vmware_dvs_portgroup.py +++ b/plugins/modules/vmware_dvs_portgroup.py @@ -321,7 +321,7 @@ required: false type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -423,8 +423,8 @@ find_dvspg_by_name, is_boolean, is_truthy, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDvsPortgroup(PyVmomi): @@ -882,7 +882,7 @@ def check_dvspg_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( portgroup_name=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_dvs_portgroup_find.py b/plugins/modules/vmware_dvs_portgroup_find.py index 1af2eb0d0..bbe56d73c 100644 --- a/plugins/modules/vmware_dvs_portgroup_find.py +++ b/plugins/modules/vmware_dvs_portgroup_find.py @@ -40,7 +40,7 @@ type: bool default: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -85,8 +85,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - vmware_argument_spec, PyVmomi) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.six.moves.urllib.parse import unquote @@ -181,7 +181,7 @@ def get_dvs_portgroup(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dvswitch=dict(type='str', required=False), vlanid=dict(type='int', required=False), diff --git a/plugins/modules/vmware_dvs_portgroup_info.py b/plugins/modules/vmware_dvs_portgroup_info.py index 437e5ead0..330bc6fbd 100644 --- a/plugins/modules/vmware_dvs_portgroup_info.py +++ b/plugins/modules/vmware_dvs_portgroup_info.py @@ -60,7 +60,7 @@ type: bool default: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -149,10 +149,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - vmware_argument_spec, PyVmomi, get_all_objs, find_dvs_by_name) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.six.moves.urllib.parse import unquote @@ -298,7 +298,7 @@ def gather_dvs_portgroup_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', required=True), show_mac_learning=dict(type='bool', default=True), diff --git a/plugins/modules/vmware_dvswitch.py b/plugins/modules/vmware_dvswitch.py index 21b756235..27a44b41a 100644 --- a/plugins/modules/vmware_dvswitch.py +++ b/plugins/modules/vmware_dvswitch.py @@ -231,7 +231,7 @@ 'internal_flows_only': false } extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -338,8 +338,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, find_dvs_by_name, vmware_argument_spec, wait_for_task + PyVmomi, TaskError, find_dvs_by_name, wait_for_task ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDvSwitch(PyVmomi): @@ -992,7 +993,7 @@ def update_dvswitch(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(aliases=['datacenter']), diff --git a/plugins/modules/vmware_dvswitch_info.py b/plugins/modules/vmware_dvswitch_info.py index 7e3a3b082..a676e30fa 100644 --- a/plugins/modules/vmware_dvswitch_info.py +++ b/plugins/modules/vmware_dvswitch_info.py @@ -63,7 +63,7 @@ elements: str required: false extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -173,7 +173,8 @@ except ImportError: pass -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj, find_object_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_obj, find_object_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -279,7 +280,7 @@ def properties_facts(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( folder=dict(type='str', required=False), switch_name=dict(type='str', required=False, aliases=['switch', 'dvswitch']), diff --git a/plugins/modules/vmware_dvswitch_lacp.py b/plugins/modules/vmware_dvswitch_lacp.py index 8ac7b491d..482370fa5 100644 --- a/plugins/modules/vmware_dvswitch_lacp.py +++ b/plugins/modules/vmware_dvswitch_lacp.py @@ -82,7 +82,7 @@ type: list default: [] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -149,8 +149,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, find_dvs_by_name, vmware_argument_spec, wait_for_task + PyVmomi, TaskError, find_dvs_by_name, wait_for_task ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDvSwitchLacp(PyVmomi): @@ -409,7 +410,7 @@ def update_lacp_group_config(self, switch_object, lacp_group_spec): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( switch=dict(required=True, aliases=['dvswitch']), diff --git a/plugins/modules/vmware_dvswitch_nioc.py b/plugins/modules/vmware_dvswitch_nioc.py index f526c2d8b..0fb533c28 100644 --- a/plugins/modules/vmware_dvswitch_nioc.py +++ b/plugins/modules/vmware_dvswitch_nioc.py @@ -84,7 +84,7 @@ default: [] elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -143,8 +143,8 @@ from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, find_dvs_by_name, - vmware_argument_spec, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDVSwitchNIOC(PyVmomi): @@ -358,7 +358,7 @@ def find_netioc_by_key(self, resource_name): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( diff --git a/plugins/modules/vmware_dvswitch_pvlans.py b/plugins/modules/vmware_dvswitch_pvlans.py index 703a19aff..246954ada 100644 --- a/plugins/modules/vmware_dvswitch_pvlans.py +++ b/plugins/modules/vmware_dvswitch_pvlans.py @@ -47,7 +47,7 @@ default: [] elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -132,8 +132,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, find_dvs_by_name, vmware_argument_spec, wait_for_task + PyVmomi, TaskError, find_dvs_by_name, wait_for_task ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDvSwitchPvlans(PyVmomi): @@ -505,7 +506,7 @@ def build_change_message(self, operation, changed_list): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( switch=dict(required=True, aliases=['dvswitch']), diff --git a/plugins/modules/vmware_dvswitch_uplink_pg.py b/plugins/modules/vmware_dvswitch_uplink_pg.py index 8d9f308a3..c2e326e85 100644 --- a/plugins/modules/vmware_dvswitch_uplink_pg.py +++ b/plugins/modules/vmware_dvswitch_uplink_pg.py @@ -117,7 +117,7 @@ type: bool default: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -190,8 +190,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, find_dvs_by_name, vmware_argument_spec, wait_for_task + PyVmomi, TaskError, find_dvs_by_name, wait_for_task ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDvSwitchUplinkPortgroup(PyVmomi): @@ -449,7 +450,7 @@ def get_lacp_support_mode(mode): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( switch=dict(required=True, aliases=['dvswitch']), diff --git a/plugins/modules/vmware_evc_mode.py b/plugins/modules/vmware_evc_mode.py index 054a27def..8f681c434 100644 --- a/plugins/modules/vmware_evc_mode.py +++ b/plugins/modules/vmware_evc_mode.py @@ -44,7 +44,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -87,9 +87,9 @@ from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, find_datacenter_by_name, - vmware_argument_spec, wait_for_task, TaskError) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareEVC(PyVmomi): @@ -204,7 +204,7 @@ def state_disable_evc(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( cluster_name=dict(type='str', required=True, aliases=['cluster']), datacenter_name=dict(type='str', required=True, aliases=['datacenter']), diff --git a/plugins/modules/vmware_export_ovf.py b/plugins/modules/vmware_export_ovf.py index 1c40cdfc3..23b2b84fa 100644 --- a/plugins/modules/vmware_export_ovf.py +++ b/plugins/modules/vmware_export_ovf.py @@ -79,7 +79,7 @@ default: 30 type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -109,7 +109,8 @@ from ansible.module_utils.urls import open_url from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text, to_bytes -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim from pyVim import connect @@ -322,7 +323,7 @@ def export_to_ovf_files(self, vm_obj): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_first_class_disk.py b/plugins/modules/vmware_first_class_disk.py index db224b7f8..6207b6f6b 100644 --- a/plugins/modules/vmware_first_class_disk.py +++ b/plugins/modules/vmware_first_class_disk.py @@ -91,7 +91,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -238,7 +239,7 @@ def delete(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(type='str'), diff --git a/plugins/modules/vmware_first_class_disk_info.py b/plugins/modules/vmware_first_class_disk_info.py index dc900bca1..d7835bd0d 100644 --- a/plugins/modules/vmware_first_class_disk_info.py +++ b/plugins/modules/vmware_first_class_disk_info.py @@ -76,7 +76,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class FirstClassDiskInfo(PyVmomi): @@ -120,7 +121,7 @@ def gather_first_class_disk_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter_name=dict(type='str'), diff --git a/plugins/modules/vmware_folder_info.py b/plugins/modules/vmware_folder_info.py index 569832fd0..747dc69f1 100644 --- a/plugins/modules/vmware_folder_info.py +++ b/plugins/modules/vmware_folder_info.py @@ -25,7 +25,7 @@ type: str aliases: ['datacenter_name'] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -131,7 +131,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareFolderInfoManager(PyVmomi): @@ -204,7 +205,7 @@ def build_folder_tree(self, folder, path): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', required=True, aliases=['datacenter_name']) ) diff --git a/plugins/modules/vmware_guest.py b/plugins/modules/vmware_guest.py index 864a8dfc7..56fb851dc 100644 --- a/plugins/modules/vmware_guest.py +++ b/plugins/modules/vmware_guest.py @@ -799,7 +799,7 @@ choices: [ 'thin', 'thick', 'eagerzeroedthick' ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -1114,7 +1114,6 @@ get_all_objs, compile_folder_path_for_object, serialize_spec, - vmware_argument_spec, set_vm_power_state, PyVmomi, find_dvs_by_name, @@ -1122,6 +1121,7 @@ wait_for_vm_ip, quote_obj_name, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper from ansible_collections.community.vmware.plugins.module_utils.vmware_spbm import SPBM @@ -3403,7 +3403,7 @@ def wait_for_customization(self, vm, timeout=3600, sleep=10): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(type='str', default='present', choices=['absent', 'poweredoff', 'powered-off', diff --git a/plugins/modules/vmware_guest_boot_info.py b/plugins/modules/vmware_guest_boot_info.py index 711488e80..c27aab38f 100644 --- a/plugins/modules/vmware_guest_boot_info.py +++ b/plugins/modules/vmware_guest_boot_info.py @@ -46,7 +46,7 @@ choices: ['first', 'last'] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -91,7 +91,8 @@ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_vm_by_id +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_vm_by_id +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim, VmomiSupport @@ -172,7 +173,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_boot_manager.py b/plugins/modules/vmware_guest_boot_manager.py index 2700ff4ba..1bb9b0f87 100644 --- a/plugins/modules/vmware_guest_boot_manager.py +++ b/plugins/modules/vmware_guest_boot_manager.py @@ -85,7 +85,7 @@ - Choose if EFI secure boot should be enabled. EFI secure boot can only be enabled with boot_firmware = efi type: 'bool' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -167,7 +167,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_vm_by_id, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_vm_by_id, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim, VmomiSupport @@ -375,7 +376,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_controller.py b/plugins/modules/vmware_guest_controller.py index e9c24bef9..62c62d1a9 100644 --- a/plugins/modules/vmware_guest_controller.py +++ b/plugins/modules/vmware_guest_controller.py @@ -127,7 +127,7 @@ default: 10 type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -246,7 +246,8 @@ import time from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper @@ -489,7 +490,7 @@ def configure_disk_controllers(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_cross_vc_clone.py b/plugins/modules/vmware_guest_cross_vc_clone.py index 748948c5e..461a8a218 100644 --- a/plugins/modules/vmware_guest_cross_vc_clone.py +++ b/plugins/modules/vmware_guest_cross_vc_clone.py @@ -117,7 +117,7 @@ default: 3600 version_added: '3.5.0' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: @@ -199,12 +199,12 @@ find_folder_by_name, find_vm_by_name, connect_to_api, - vmware_argument_spec, gather_vm_facts, find_obj, find_resource_pool_by_name, wait_for_task, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim except ImportError: @@ -344,7 +344,7 @@ def main(): """ Main method """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_custom_attribute_defs.py b/plugins/modules/vmware_guest_custom_attribute_defs.py index 9ff05e412..c3dccd569 100644 --- a/plugins/modules/vmware_guest_custom_attribute_defs.py +++ b/plugins/modules/vmware_guest_custom_attribute_defs.py @@ -36,7 +36,7 @@ choices: ['present', 'absent'] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -71,7 +71,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim @@ -113,7 +114,7 @@ def add_custom_def(self, field): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( attribute_key=dict(type='str', no_log=False), state=dict(type='str', default='present', choices=['absent', 'present']), diff --git a/plugins/modules/vmware_guest_custom_attributes.py b/plugins/modules/vmware_guest_custom_attributes.py index 7f7566ebd..4b5d66afc 100644 --- a/plugins/modules/vmware_guest_custom_attributes.py +++ b/plugins/modules/vmware_guest_custom_attributes.py @@ -76,7 +76,7 @@ type: list elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -154,7 +154,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmAttributeManager(PyVmomi): @@ -304,7 +305,7 @@ def check_exists(self, vm, user_fields): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str'), name=dict(type='str'), diff --git a/plugins/modules/vmware_guest_customization_info.py b/plugins/modules/vmware_guest_customization_info.py index 5fd637d36..d8a978869 100644 --- a/plugins/modules/vmware_guest_customization_info.py +++ b/plugins/modules/vmware_guest_customization_info.py @@ -25,7 +25,7 @@ required: false type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -89,7 +89,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareCustomSpecManger(PyVmomi): @@ -172,7 +173,7 @@ def gather_custom_spec_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( spec_name=dict(type='str'), ) diff --git a/plugins/modules/vmware_guest_disk.py b/plugins/modules/vmware_guest_disk.py index 960fe8917..487cd4473 100644 --- a/plugins/modules/vmware_guest_disk.py +++ b/plugins/modules/vmware_guest_disk.py @@ -229,7 +229,7 @@ type: list elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -511,8 +511,9 @@ from random import randint from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, \ +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, \ wait_for_task, find_obj, get_all_objs, get_parent_datacenter +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper @@ -1137,7 +1138,7 @@ def get_recommended_datastore(self, datastore_cluster_obj, disk_spec_obj): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_disk_info.py b/plugins/modules/vmware_guest_disk_info.py index 2be78c64b..b0463d8d5 100644 --- a/plugins/modules/vmware_guest_disk_info.py +++ b/plugins/modules/vmware_guest_disk_info.py @@ -62,7 +62,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -148,12 +148,13 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_file_operation.py b/plugins/modules/vmware_guest_file_operation.py index 487fe1298..7ce3fcef6 100644 --- a/plugins/modules/vmware_guest_file_operation.py +++ b/plugins/modules/vmware_guest_file_operation.py @@ -154,7 +154,7 @@ version_added: '3.1.0' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -234,7 +234,8 @@ from ansible.module_utils._text import to_bytes, to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, find_cluster_by_name, find_datacenter_by_name, - find_vm_by_id, vmware_argument_spec) + find_vm_by_id) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareGuestFileManager(PyVmomi): @@ -453,7 +454,7 @@ def copy(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( datacenter=dict(type='str'), cluster=dict(type='str'), diff --git a/plugins/modules/vmware_guest_find.py b/plugins/modules/vmware_guest_find.py index 64b5b2f3a..3026417bf 100644 --- a/plugins/modules/vmware_guest_find.py +++ b/plugins/modules/vmware_guest_find.py @@ -34,7 +34,7 @@ default: false type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -71,7 +71,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_vm_by_id +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_vm_by_id +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim @@ -113,7 +114,7 @@ def getvm_folder_paths(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_info.py b/plugins/modules/vmware_guest_info.py index 1b2442e9e..56641d2d7 100644 --- a/plugins/modules/vmware_guest_info.py +++ b/plugins/modules/vmware_guest_info.py @@ -108,7 +108,7 @@ elements: str required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -238,7 +238,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient try: from com.vmware.vapi.std_client import DynamicID # noqa: F401 @@ -255,7 +256,7 @@ def __init__(self, module): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), name_match=dict(type='str', choices=['first', 'last'], default='first'), diff --git a/plugins/modules/vmware_guest_instant_clone.py b/plugins/modules/vmware_guest_instant_clone.py index 3b8c17972..4932a4080 100644 --- a/plugins/modules/vmware_guest_instant_clone.py +++ b/plugins/modules/vmware_guest_instant_clone.py @@ -139,7 +139,7 @@ type: int default: 300 extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: - Anant Chopra (@Anant99-sys) @@ -274,11 +274,11 @@ find_vm_by_name, find_vm_by_id, connect_to_api, - vmware_argument_spec, find_obj, wait_for_task, set_vm_power_state ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim @@ -517,7 +517,7 @@ def populate_specs(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str', required=True, aliases=['vm_name']), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_move.py b/plugins/modules/vmware_guest_move.py index 2b7e4ae5a..0c3921b7e 100644 --- a/plugins/modules/vmware_guest_move.py +++ b/plugins/modules/vmware_guest_move.py @@ -67,7 +67,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -167,7 +167,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -176,7 +177,7 @@ def __init__(self, module): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), name_match=dict( diff --git a/plugins/modules/vmware_guest_network.py b/plugins/modules/vmware_guest_network.py index 799d19d3f..7f72f36e5 100644 --- a/plugins/modules/vmware_guest_network.py +++ b/plugins/modules/vmware_guest_network.py @@ -155,7 +155,7 @@ - Return information about current guest network adapters. type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -289,7 +289,8 @@ import copy from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper @@ -757,7 +758,7 @@ def _nic_present(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_powerstate.py b/plugins/modules/vmware_guest_powerstate.py index 1391c6181..b59c9aca4 100644 --- a/plugins/modules/vmware_guest_powerstate.py +++ b/plugins/modules/vmware_guest_powerstate.py @@ -126,7 +126,7 @@ type: list elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ EXAMPLES = r""" @@ -214,13 +214,14 @@ from random import randint from datetime import datetime from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, set_vm_power_state, vmware_argument_spec, \ +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, set_vm_power_state, \ check_answer_question_status, make_answer_response, answer_question, gather_vm_facts +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', default='ha-datacenter'), state=dict(type='str', default='present', diff --git a/plugins/modules/vmware_guest_register_operation.py b/plugins/modules/vmware_guest_register_operation.py index 6873b35d5..05166a904 100644 --- a/plugins/modules/vmware_guest_register_operation.py +++ b/plugins/modules/vmware_guest_register_operation.py @@ -78,7 +78,7 @@ choices: [ present, absent ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -138,8 +138,9 @@ from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_resource_pool_by_name, \ +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_resource_pool_by_name, \ wait_for_task, compile_folder_path_for_object, find_cluster_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -249,7 +250,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(datacenter=dict(type="str", default="ha-datacenter"), cluster=dict(type="str"), folder=dict(type="str"), diff --git a/plugins/modules/vmware_guest_screenshot.py b/plugins/modules/vmware_guest_screenshot.py index 5ba4eb784..99fc3bd4e 100644 --- a/plugins/modules/vmware_guest_screenshot.py +++ b/plugins/modules/vmware_guest_screenshot.py @@ -75,7 +75,7 @@ facts manually.' type: path extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -131,7 +131,8 @@ from ansible.module_utils.six.moves.urllib.parse import urlencode, quote from ansible.module_utils._text import to_native from ansible.module_utils.urls import open_url -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, get_parent_datacenter +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task, get_parent_datacenter +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec import os @@ -242,7 +243,7 @@ def take_vm_screenshot(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_sendkey.py b/plugins/modules/vmware_guest_sendkey.py index 5340a2da6..db5a5c230 100644 --- a/plugins/modules/vmware_guest_sendkey.py +++ b/plugins/modules/vmware_guest_sendkey.py @@ -89,7 +89,7 @@ type: int default: 0 extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -162,7 +162,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -368,7 +369,7 @@ def send_key_to_vm(self, vm_obj): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_serial_port.py b/plugins/modules/vmware_guest_serial_port.py index 8b7a69f0b..1c7e99919 100644 --- a/plugins/modules/vmware_guest_serial_port.py +++ b/plugins/modules/vmware_guest_serial_port.py @@ -124,7 +124,7 @@ - Required when O(backings[].backing_type=file). type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: - Anusha Hegde (@anusha94) ''' @@ -213,7 +213,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native try: from pyVmomi import vim @@ -515,7 +516,7 @@ def main(): """ Main method """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_snapshot.py b/plugins/modules/vmware_guest_snapshot.py index cc5609842..e0f9dad91 100644 --- a/plugins/modules/vmware_guest_snapshot.py +++ b/plugins/modules/vmware_guest_snapshot.py @@ -128,7 +128,7 @@ - Value to change the description of an existing snapshot to. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -286,7 +286,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, list_snapshots, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, list_snapshots +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -435,7 +436,7 @@ def apply_snapshot_op(self, vm): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(default='present', choices=['present', 'absent', 'revert', 'remove_all']), name=dict(type='str'), diff --git a/plugins/modules/vmware_guest_snapshot_info.py b/plugins/modules/vmware_guest_snapshot_info.py index 562dd3261..3a80eea2b 100644 --- a/plugins/modules/vmware_guest_snapshot_info.py +++ b/plugins/modules/vmware_guest_snapshot_info.py @@ -62,7 +62,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -117,7 +117,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, list_snapshots, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, list_snapshots +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -140,7 +141,7 @@ def gather_guest_snapshot_info(vm_obj=None): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_storage_policy.py b/plugins/modules/vmware_guest_storage_policy.py index 7ae239d85..e3fe8c8c2 100644 --- a/plugins/modules/vmware_guest_storage_policy.py +++ b/plugins/modules/vmware_guest_storage_policy.py @@ -98,7 +98,7 @@ type: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -162,7 +162,8 @@ PYVMOMI_IMP_ERR = traceback.format_exc() from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_spbm import SPBM @@ -397,7 +398,7 @@ def ensure_storage_policies(self, vm_obj): def run_module(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_tools_info.py b/plugins/modules/vmware_guest_tools_info.py index 13e41efc3..ed32a2c58 100644 --- a/plugins/modules/vmware_guest_tools_info.py +++ b/plugins/modules/vmware_guest_tools_info.py @@ -66,7 +66,7 @@ - The datacenter name to which virtual machine belongs to. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -118,7 +118,8 @@ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -152,7 +153,7 @@ def gather_vmtools_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_tools_upgrade.py b/plugins/modules/vmware_guest_tools_upgrade.py index ed4f54f26..8471c9979 100644 --- a/plugins/modules/vmware_guest_tools_upgrade.py +++ b/plugins/modules/vmware_guest_tools_upgrade.py @@ -77,7 +77,7 @@ type: str required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: - Mike Klebolt (@MikeKlebolt) @@ -118,7 +118,8 @@ from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -202,7 +203,7 @@ def upgrade_tools(self, vm): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), name_match=dict(type='str', choices=['first', 'last'], default='first'), diff --git a/plugins/modules/vmware_guest_tools_wait.py b/plugins/modules/vmware_guest_tools_wait.py index 13ed6c164..d46d2320e 100644 --- a/plugins/modules/vmware_guest_tools_wait.py +++ b/plugins/modules/vmware_guest_tools_wait.py @@ -71,7 +71,7 @@ - The datacenter to search for a virtual machine. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -131,7 +131,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, gather_vm_facts, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, gather_vm_facts +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -158,7 +159,7 @@ def wait_for_tools(self, vm, timeout): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), name_match=dict(type='str', default='first', choices=['first', 'last']), diff --git a/plugins/modules/vmware_guest_tpm.py b/plugins/modules/vmware_guest_tpm.py index 062bf2c5b..a655faa6f 100644 --- a/plugins/modules/vmware_guest_tpm.py +++ b/plugins/modules/vmware_guest_tpm.py @@ -65,7 +65,7 @@ choices: ['present', 'absent'] default: 'present' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -107,7 +107,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper @@ -192,7 +193,7 @@ def vtpm_operation(self, vm_obj=None): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_guest_vgpu.py b/plugins/modules/vmware_guest_vgpu.py index b3ecd5244..04fa3a546 100644 --- a/plugins/modules/vmware_guest_vgpu.py +++ b/plugins/modules/vmware_guest_vgpu.py @@ -88,7 +88,7 @@ - The ESXi hostname where the virtual machine is running. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ EXAMPLES = r""" @@ -144,9 +144,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, wait_for_task, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -335,7 +335,7 @@ def _get_vgpu_profiles_name(self, vm_obj, vgpu_prfl): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type="str"), uuid=dict(type="str"), diff --git a/plugins/modules/vmware_guest_vgpu_info.py b/plugins/modules/vmware_guest_vgpu_info.py index 1bdeae6f2..6276f53ca 100644 --- a/plugins/modules/vmware_guest_vgpu_info.py +++ b/plugins/modules/vmware_guest_vgpu_info.py @@ -62,7 +62,7 @@ default: false type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ EXAMPLES = r""" @@ -103,8 +103,8 @@ from ansible.module_utils._text import to_text from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -134,7 +134,7 @@ def gather_vgpu_profile_facts(self, vm_obj): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type="str"), uuid=dict(type="str"), diff --git a/plugins/modules/vmware_guest_video.py b/plugins/modules/vmware_guest_video.py index 62c3ad9c7..8aaa69614 100644 --- a/plugins/modules/vmware_guest_video.py +++ b/plugins/modules/vmware_guest_video.py @@ -92,7 +92,7 @@ - The value of 3D Memory must be power of 2 and valid value is from 32 MB to 2048 MB. type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -165,7 +165,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PyVmomiHelper(PyVmomi): @@ -321,7 +322,7 @@ def reconfigure_vm_video(self, vm_obj): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_host.py b/plugins/modules/vmware_host.py index 228a1280c..be4085530 100644 --- a/plugins/modules/vmware_host.py +++ b/plugins/modules/vmware_host.py @@ -117,7 +117,7 @@ type: bool default: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -204,9 +204,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, vmware_argument_spec, + PyVmomi, TaskError, wait_for_task, find_host_by_cluster_datacenter, find_hostsystem_by_name ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareHost(PyVmomi): @@ -787,7 +788,7 @@ def disconnect_host(self, host_object): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter_name=dict(type='str', required=True, aliases=['datacenter']), cluster_name=dict(type='str', aliases=['cluster']), diff --git a/plugins/modules/vmware_host_acceptance.py b/plugins/modules/vmware_host_acceptance.py index 92dc98328..309c9b3c9 100644 --- a/plugins/modules/vmware_host_acceptance.py +++ b/plugins/modules/vmware_host_acceptance.py @@ -41,7 +41,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -81,7 +81,8 @@ except ImportError: pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -121,7 +122,7 @@ def set_acceptance_level(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_acceptance_info.py b/plugins/modules/vmware_host_acceptance_info.py index 03308c975..c129ead6a 100644 --- a/plugins/modules/vmware_host_acceptance_info.py +++ b/plugins/modules/vmware_host_acceptance_info.py @@ -34,7 +34,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -63,7 +63,8 @@ except ImportError: pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -88,7 +89,7 @@ def gather_acceptance_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_active_directory.py b/plugins/modules/vmware_host_active_directory.py index b6b205c2e..89e318731 100644 --- a/plugins/modules/vmware_host_active_directory.py +++ b/plugins/modules/vmware_host_active_directory.py @@ -52,7 +52,7 @@ - This parameter is required if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -103,7 +103,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -331,7 +332,7 @@ def get_ad_auth_object(self, host_object): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( ad_domain=dict(type='str', default='', aliases=['domain', 'domain_name']), ad_user=dict(type='str', default=''), diff --git a/plugins/modules/vmware_host_auto_start.py b/plugins/modules/vmware_host_auto_start.py index 4109066de..d327497ee 100644 --- a/plugins/modules/vmware_host_auto_start.py +++ b/plugins/modules/vmware_host_auto_start.py @@ -125,7 +125,7 @@ choices: ['no', 'yes', 'systemDefault'] default: systemDefault extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -199,7 +199,8 @@ pass from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -333,7 +334,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(esxi_hostname=dict(type='str', required=True), name=dict(type='str'), uuid=dict(type='str'), diff --git a/plugins/modules/vmware_host_capability_info.py b/plugins/modules/vmware_host_capability_info.py index ac6030cba..6728c23d0 100644 --- a/plugins/modules/vmware_host_capability_info.py +++ b/plugins/modules/vmware_host_capability_info.py @@ -29,7 +29,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -71,7 +71,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class CapabilityInfoManager(PyVmomi): @@ -199,7 +200,7 @@ def gather_host_capability_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_config_info.py b/plugins/modules/vmware_host_config_info.py index 49796818d..15b4af631 100644 --- a/plugins/modules/vmware_host_config_info.py +++ b/plugins/modules/vmware_host_config_info.py @@ -29,7 +29,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -69,7 +69,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareConfigInfoManager(PyVmomi): @@ -90,7 +91,7 @@ def gather_host_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_config_manager.py b/plugins/modules/vmware_host_config_manager.py index 1c331631f..e341bf82a 100644 --- a/plugins/modules/vmware_host_config_manager.py +++ b/plugins/modules/vmware_host_config_manager.py @@ -38,7 +38,7 @@ default: {} type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -85,7 +85,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, is_boolean, is_integer, is_truthy +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, is_boolean, is_integer, is_truthy +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native from ansible.module_utils.six import integer_types, string_types @@ -167,7 +168,7 @@ def set_host_configuration_facts(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_custom_attributes.py b/plugins/modules/vmware_host_custom_attributes.py index 7285e322c..6bfc2c9ee 100644 --- a/plugins/modules/vmware_host_custom_attributes.py +++ b/plugins/modules/vmware_host_custom_attributes.py @@ -50,7 +50,7 @@ type: list elements: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -101,7 +101,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class HostAttributeManager(PyVmomi): @@ -150,7 +151,7 @@ def check_exists(self, field): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True), state=dict(type='str', default='present', diff --git a/plugins/modules/vmware_host_datastore.py b/plugins/modules/vmware_host_datastore.py index fa41c0ade..1b531e4c3 100644 --- a/plugins/modules/vmware_host_datastore.py +++ b/plugins/modules/vmware_host_datastore.py @@ -96,7 +96,7 @@ choices: [ present, absent ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -192,7 +192,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, find_datastore_by_name, find_obj, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import find_datastore_by_name, find_obj, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_sms import SMS from ansible.module_utils._text import to_native @@ -414,7 +415,7 @@ def mount_vvol_datastore_host(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datastore_name=dict(type='str', required=True), datastore_type=dict(type='str', choices=['nfs', 'nfs41', 'vmfs', 'vvol']), diff --git a/plugins/modules/vmware_host_disk_info.py b/plugins/modules/vmware_host_disk_info.py index 117751d98..769797030 100644 --- a/plugins/modules/vmware_host_disk_info.py +++ b/plugins/modules/vmware_host_disk_info.py @@ -30,7 +30,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = ''' @@ -85,7 +85,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class HostDiskInfo(PyVmomi): @@ -144,7 +145,7 @@ def gather_host_disk_info(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_dns.py b/plugins/modules/vmware_host_dns.py index 287a929f1..babb0283b 100644 --- a/plugins/modules/vmware_host_dns.py +++ b/plugins/modules/vmware_host_dns.py @@ -71,7 +71,7 @@ - Cannot be used when you connect directly to an ESXi host. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -147,7 +147,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -425,7 +426,7 @@ def get_differt_entries(list1, list2): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( type=dict(required=True, type='str', choices=['dhcp', 'static']), device=dict(type='str'), diff --git a/plugins/modules/vmware_host_dns_info.py b/plugins/modules/vmware_host_dns_info.py index b03c25d42..13d7032c7 100644 --- a/plugins/modules/vmware_host_dns_info.py +++ b/plugins/modules/vmware_host_dns_info.py @@ -29,7 +29,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -73,7 +73,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDnsInfoManager(PyVmomi): @@ -99,7 +100,7 @@ def gather_dns_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_facts.py b/plugins/modules/vmware_host_facts.py index 1bfd64012..c038b5021 100644 --- a/plugins/modules/vmware_host_facts.py +++ b/plugins/modules/vmware_host_facts.py @@ -67,7 +67,7 @@ elements: str required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -231,10 +231,10 @@ from ansible.module_utils.common.text.formatters import bytes_to_human from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, find_obj, ansible_date_time_facts ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec try: from pyVmomi import vim, vmodl @@ -417,7 +417,7 @@ def properties_facts(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=False), show_tag=dict(type='bool', default=False), diff --git a/plugins/modules/vmware_host_feature_info.py b/plugins/modules/vmware_host_feature_info.py index dcf885e47..bd353488d 100644 --- a/plugins/modules/vmware_host_feature_info.py +++ b/plugins/modules/vmware_host_feature_info.py @@ -29,7 +29,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -83,7 +83,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class FeatureCapabilityInfoManager(PyVmomi): @@ -112,7 +113,7 @@ def gather_host_feature_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_firewall_info.py b/plugins/modules/vmware_host_firewall_info.py index 05479fe51..a30139865 100644 --- a/plugins/modules/vmware_host_firewall_info.py +++ b/plugins/modules/vmware_host_firewall_info.py @@ -29,7 +29,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -87,7 +87,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class FirewallInfoManager(PyVmomi): @@ -134,7 +135,7 @@ def gather_host_firewall_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_firewall_manager.py b/plugins/modules/vmware_host_firewall_manager.py index 3f70a5c8d..6a3129a18 100644 --- a/plugins/modules/vmware_host_firewall_manager.py +++ b/plugins/modules/vmware_host_firewall_manager.py @@ -75,7 +75,7 @@ elements: str default: [] extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -204,7 +204,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native import socket @@ -392,7 +393,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_graphics.py b/plugins/modules/vmware_host_graphics.py index aa357602f..413937e4f 100644 --- a/plugins/modules/vmware_host_graphics.py +++ b/plugins/modules/vmware_host_graphics.py @@ -48,7 +48,7 @@ default: False type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -90,7 +90,8 @@ HAS_PYVMOMI = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -162,7 +163,7 @@ def ensure(self): def main(): """ Main module method""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str'), esxi_hostname=dict(type='list', elements='str'), diff --git a/plugins/modules/vmware_host_hyperthreading.py b/plugins/modules/vmware_host_hyperthreading.py index 556dc3cd3..9da782cec 100644 --- a/plugins/modules/vmware_host_hyperthreading.py +++ b/plugins/modules/vmware_host_hyperthreading.py @@ -39,7 +39,7 @@ - This parameter is required if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -92,7 +92,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -227,7 +228,7 @@ def ensure(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(default='enabled', choices=['enabled', 'disabled']), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_ipv6.py b/plugins/modules/vmware_host_ipv6.py index 8c6cf3cf0..3bd048121 100644 --- a/plugins/modules/vmware_host_ipv6.py +++ b/plugins/modules/vmware_host_ipv6.py @@ -37,7 +37,7 @@ - This is required parameter if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -89,7 +89,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -205,7 +206,7 @@ def main(): """ Main """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(default='enabled', choices=['enabled', 'disabled']), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_iscsi.py b/plugins/modules/vmware_host_iscsi.py index c6e2eced2..533e4fb9f 100644 --- a/plugins/modules/vmware_host_iscsi.py +++ b/plugins/modules/vmware_host_iscsi.py @@ -265,7 +265,7 @@ - enabled - disabled extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -378,7 +378,8 @@ pass from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule from copy import deepcopy @@ -851,7 +852,7 @@ def main(): mutual_chap_inherited=dict(type='bool', default=True) ) - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True), iscsi_config=dict(type='dict', diff --git a/plugins/modules/vmware_host_iscsi_info.py b/plugins/modules/vmware_host_iscsi_info.py index d9599a26d..9a697b7f6 100644 --- a/plugins/modules/vmware_host_iscsi_info.py +++ b/plugins/modules/vmware_host_iscsi_info.py @@ -22,7 +22,7 @@ type: str required: true extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -120,7 +120,8 @@ pass import re -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -202,7 +203,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True) ) diff --git a/plugins/modules/vmware_host_kernel_manager.py b/plugins/modules/vmware_host_kernel_manager.py index 1fdfec703..b0a0d7139 100644 --- a/plugins/modules/vmware_host_kernel_manager.py +++ b/plugins/modules/vmware_host_kernel_manager.py @@ -44,7 +44,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -92,7 +92,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -179,7 +180,7 @@ def check_host_configuration_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() # add the arguments we're going to use for this module argument_spec.update( cluster_name=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_lockdown.py b/plugins/modules/vmware_host_lockdown.py index a5b1da457..2b234714f 100644 --- a/plugins/modules/vmware_host_lockdown.py +++ b/plugins/modules/vmware_host_lockdown.py @@ -46,7 +46,7 @@ choices: [ disabled, normal, strict ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -124,7 +124,8 @@ HAS_PYVMOMI = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -181,7 +182,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='list', required=False, elements='str'), diff --git a/plugins/modules/vmware_host_lockdown_exceptions.py b/plugins/modules/vmware_host_lockdown_exceptions.py index 709243ee0..d7fd2c3ee 100644 --- a/plugins/modules/vmware_host_lockdown_exceptions.py +++ b/plugins/modules/vmware_host_lockdown_exceptions.py @@ -48,7 +48,7 @@ elements: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -89,7 +89,8 @@ HAS_PYVMOMI = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -161,7 +162,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='list', required=False, elements='str'), diff --git a/plugins/modules/vmware_host_logbundle.py b/plugins/modules/vmware_host_logbundle.py index 46e7516c3..c5b61c74e 100644 --- a/plugins/modules/vmware_host_logbundle.py +++ b/plugins/modules/vmware_host_logbundle.py @@ -113,7 +113,7 @@ type: int default: 5 extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -164,7 +164,8 @@ import xml.etree.ElementTree as ET -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url @@ -242,7 +243,7 @@ def get_logbundle(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True), dest=dict(type='str', required=True), diff --git a/plugins/modules/vmware_host_logbundle_info.py b/plugins/modules/vmware_host_logbundle_info.py index e066430ad..7c94f988d 100644 --- a/plugins/modules/vmware_host_logbundle_info.py +++ b/plugins/modules/vmware_host_logbundle_info.py @@ -24,7 +24,7 @@ type: str required: true extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -87,7 +87,8 @@ except ImportError: pass -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.urls import fetch_url import xml.etree.ElementTree as ET @@ -127,7 +128,7 @@ def get_listmanifests(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True) ) diff --git a/plugins/modules/vmware_host_ntp.py b/plugins/modules/vmware_host_ntp.py index d04e0820c..2e45469c9 100644 --- a/plugins/modules/vmware_host_ntp.py +++ b/plugins/modules/vmware_host_ntp.py @@ -54,7 +54,7 @@ required: false default: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -132,7 +132,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -362,7 +363,7 @@ def get_differt_entries(list1, list2): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_ntp_info.py b/plugins/modules/vmware_host_ntp_info.py index 0bc976d54..4ad62483e 100644 --- a/plugins/modules/vmware_host_ntp_info.py +++ b/plugins/modules/vmware_host_ntp_info.py @@ -31,7 +31,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -75,7 +75,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareNtpInfoManager(PyVmomi): @@ -105,7 +106,7 @@ def gather_ntp_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_package_info.py b/plugins/modules/vmware_host_package_info.py index fd0a27cd8..d44563c95 100644 --- a/plugins/modules/vmware_host_package_info.py +++ b/plugins/modules/vmware_host_package_info.py @@ -31,7 +31,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -65,7 +65,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwarePackageManager(PyVmomi): @@ -98,7 +99,7 @@ def gather_package_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_passthrough.py b/plugins/modules/vmware_host_passthrough.py index 3b8b36633..0ca00579b 100644 --- a/plugins/modules/vmware_host_passthrough.py +++ b/plugins/modules/vmware_host_passthrough.py @@ -54,7 +54,7 @@ default: present type: str extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options """ EXAMPLES = r""" @@ -140,7 +140,8 @@ pass import copy -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -332,7 +333,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster=dict(type='str', aliases=['cluster_name']), esxi_hostname=dict(type='str'), diff --git a/plugins/modules/vmware_host_powermgmt_policy.py b/plugins/modules/vmware_host_powermgmt_policy.py index 4bce43970..23bf1c7e9 100644 --- a/plugins/modules/vmware_host_powermgmt_policy.py +++ b/plugins/modules/vmware_host_powermgmt_policy.py @@ -35,7 +35,7 @@ - This is required parameter if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -84,7 +84,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -201,7 +202,7 @@ def main(): """ Main """ - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( policy=dict(type='str', default='balanced', choices=['high-performance', 'balanced', 'low-power', 'custom']), diff --git a/plugins/modules/vmware_host_powerstate.py b/plugins/modules/vmware_host_powerstate.py index eaebf8374..22895ad36 100644 --- a/plugins/modules/vmware_host_powerstate.py +++ b/plugins/modules/vmware_host_powerstate.py @@ -55,7 +55,7 @@ default: 600 type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -105,7 +105,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task, TaskError +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -193,7 +194,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( state=dict(type='str', default='shutdown-host', choices=['power-down-to-standby', 'power-up-from-standby', 'shutdown-host', 'reboot-host']), diff --git a/plugins/modules/vmware_host_scanhba.py b/plugins/modules/vmware_host_scanhba.py index 54addd438..de4655129 100644 --- a/plugins/modules/vmware_host_scanhba.py +++ b/plugins/modules/vmware_host_scanhba.py @@ -51,7 +51,7 @@ default: false type: bool extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -108,7 +108,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareHbaScan(PyVmomi): @@ -146,7 +147,7 @@ def scan(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=False), cluster_name=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_scsidisk_info.py b/plugins/modules/vmware_host_scsidisk_info.py index 7619edebe..1b60bb3fc 100644 --- a/plugins/modules/vmware_host_scsidisk_info.py +++ b/plugins/modules/vmware_host_scsidisk_info.py @@ -32,7 +32,7 @@ - This parameter is required if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -88,7 +88,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareHostDiskManager(PyVmomi): @@ -151,7 +152,7 @@ def gather_disk_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=False), cluster_name=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_service_info.py b/plugins/modules/vmware_host_service_info.py index 21e45ca74..9b5811312 100644 --- a/plugins/modules/vmware_host_service_info.py +++ b/plugins/modules/vmware_host_service_info.py @@ -33,7 +33,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -90,7 +90,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareServiceManager(PyVmomi): @@ -125,7 +126,7 @@ def gather_host_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_service_manager.py b/plugins/modules/vmware_host_service_manager.py index f63a80435..fc80c52cb 100644 --- a/plugins/modules/vmware_host_service_manager.py +++ b/plugins/modules/vmware_host_service_manager.py @@ -56,7 +56,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -112,7 +112,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -194,7 +195,7 @@ def check_service_state(self, host, service_name): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_snmp.py b/plugins/modules/vmware_host_snmp.py index 095bd9a63..c2e0fca48 100644 --- a/plugins/modules/vmware_host_snmp.py +++ b/plugins/modules/vmware_host_snmp.py @@ -94,7 +94,7 @@ - System location. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -184,7 +184,8 @@ HAS_PYVMOMI = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -553,7 +554,7 @@ def check_if_options_are_valid(self, target): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='list', elements='str', required=False), diff --git a/plugins/modules/vmware_host_sriov.py b/plugins/modules/vmware_host_sriov.py index 69e391f13..158db2d6d 100644 --- a/plugins/modules/vmware_host_sriov.py +++ b/plugins/modules/vmware_host_sriov.py @@ -51,7 +51,7 @@ type: bool required: false extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -149,7 +149,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from time import sleep @@ -342,7 +343,7 @@ def _update_sriov(self, host, sriovEnabled, numVirtualFunction): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type="str", required=False), esxi_hostname=dict(type="str", required=False), diff --git a/plugins/modules/vmware_host_ssl_info.py b/plugins/modules/vmware_host_ssl_info.py index de3162d4b..accee10cf 100644 --- a/plugins/modules/vmware_host_ssl_info.py +++ b/plugins/modules/vmware_host_ssl_info.py @@ -31,7 +31,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -90,7 +90,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareHostSslManager(PyVmomi): @@ -118,7 +119,7 @@ def gather_ssl_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str'), esxi_hostname=dict(type='str'), diff --git a/plugins/modules/vmware_host_tcpip_stacks.py b/plugins/modules/vmware_host_tcpip_stacks.py index c772846d3..5195b16e7 100644 --- a/plugins/modules/vmware_host_tcpip_stacks.py +++ b/plugins/modules/vmware_host_tcpip_stacks.py @@ -153,7 +153,7 @@ aliases: - nsx_overlay extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -292,7 +292,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareHostTcpipStack(PyVmomi): @@ -573,7 +574,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type='str', required=True), default=dict(type='dict', diff --git a/plugins/modules/vmware_host_user_manager.py b/plugins/modules/vmware_host_user_manager.py index f2ebaf934..1f660cefd 100644 --- a/plugins/modules/vmware_host_user_manager.py +++ b/plugins/modules/vmware_host_user_manager.py @@ -56,7 +56,7 @@ - present - absent extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -114,7 +114,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareHostUserManager(PyVmomi): @@ -236,7 +237,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( esxi_hostname=dict(type="str", required=True), user_name=dict(type="str", required=True, aliases=["local_user_name"]), diff --git a/plugins/modules/vmware_host_vmhba_info.py b/plugins/modules/vmware_host_vmhba_info.py index 178d806a8..3d722a9cd 100644 --- a/plugins/modules/vmware_host_vmhba_info.py +++ b/plugins/modules/vmware_host_vmhba_info.py @@ -33,7 +33,7 @@ - This parameter is required if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -117,7 +117,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class HostVmhbaMgr(PyVmomi): @@ -199,7 +200,7 @@ def format_number(number): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_host_vmnic_info.py b/plugins/modules/vmware_host_vmnic_info.py index af6bfc6f9..491d78244 100644 --- a/plugins/modules/vmware_host_vmnic_info.py +++ b/plugins/modules/vmware_host_vmnic_info.py @@ -50,7 +50,7 @@ - This parameter is required if O(esxi_hostname) is not specified. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -162,7 +162,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class HostVmnicMgr(PyVmomi): @@ -319,7 +320,7 @@ def gather_host_vmnic_info(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_local_role_info.py b/plugins/modules/vmware_local_role_info.py index cc9b15f2f..43b7b1e6d 100644 --- a/plugins/modules/vmware_local_role_info.py +++ b/plugins/modules/vmware_local_role_info.py @@ -21,7 +21,7 @@ - Be sure that the user used for login, has the appropriate rights to view roles - The module returns a list of dict in version 2.8 and above. extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -82,7 +82,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareLocalRoleInfo(PyVmomi): @@ -119,7 +120,7 @@ def gather_local_role_info(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/vmware_local_role_manager.py b/plugins/modules/vmware_local_role_manager.py index cebf4000e..dfc5d7750 100644 --- a/plugins/modules/vmware_local_role_manager.py +++ b/plugins/modules/vmware_local_role_manager.py @@ -56,7 +56,7 @@ choices: [ add, remove, set ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -158,7 +158,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareLocalRoleManager(PyVmomi): @@ -381,7 +382,7 @@ def state_update_role(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(local_role_name=dict(required=True, type='str'), local_privilege_ids=dict(default=[], type='list', elements='str'), force_remove=dict(default=False, type='bool'), diff --git a/plugins/modules/vmware_local_user_info.py b/plugins/modules/vmware_local_user_info.py index d5bf17e35..a140c87ca 100644 --- a/plugins/modules/vmware_local_user_info.py +++ b/plugins/modules/vmware_local_user_info.py @@ -21,7 +21,7 @@ - Abhijeet Kasurde (@Akasurde) - Christian Kotte (@ckotte) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -66,7 +66,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -142,7 +143,7 @@ def get_role_name(role_id, role_list): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/vmware_local_user_manager.py b/plugins/modules/vmware_local_user_manager.py index 065e8e0a0..42bb7b727 100644 --- a/plugins/modules/vmware_local_user_manager.py +++ b/plugins/modules/vmware_local_user_manager.py @@ -43,7 +43,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -66,7 +66,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareLocalUserManager(PyVmomi): @@ -163,7 +164,7 @@ def state_exit_unchanged(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(local_user_name=dict(required=True, type='str'), local_user_password=dict(type='str', no_log=True), local_user_description=dict(type='str'), diff --git a/plugins/modules/vmware_maintenancemode.py b/plugins/modules/vmware_maintenancemode.py index faeda3a31..4ecac7c08 100644 --- a/plugins/modules/vmware_maintenancemode.py +++ b/plugins/modules/vmware_maintenancemode.py @@ -58,7 +58,7 @@ required: false type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -100,7 +100,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, vmware_argument_spec, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, TaskError, wait_for_task +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -172,7 +173,7 @@ def ExitMaintenanceMode(self): def main(): - spec = vmware_argument_spec() + spec = base_argument_spec() spec.update(dict(esxi_hostname=dict(type='str', required=True), vsan=dict(type='str', choices=['ensureObjectAccessibility', diff --git a/plugins/modules/vmware_migrate_vmk.py b/plugins/modules/vmware_migrate_vmk.py index b50ba7f5d..28014f5b7 100644 --- a/plugins/modules/vmware_migrate_vmk.py +++ b/plugins/modules/vmware_migrate_vmk.py @@ -55,7 +55,7 @@ - Will be ignored when migrating from VSS to VDS type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -81,8 +81,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - vmware_argument_spec, find_dvs_by_name, find_hostsystem_by_name, + find_dvs_by_name, find_hostsystem_by_name, connect_to_api, find_dvspg_by_name) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareMigrateVmk(object): @@ -207,7 +208,7 @@ def check_vmk_current_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(esxi_hostname=dict(required=True, type='str'), device=dict(required=True, type='str'), current_switch_name=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_object_custom_attributes_info.py b/plugins/modules/vmware_object_custom_attributes_info.py index 7d2fa00e5..3a7e40da3 100644 --- a/plugins/modules/vmware_object_custom_attributes_info.py +++ b/plugins/modules/vmware_object_custom_attributes_info.py @@ -46,7 +46,7 @@ - This is required if O(object_name) is not supplied. type: str extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options """ EXAMPLES = r""" @@ -105,7 +105,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareCustomAttributesInfo(PyVmomi): @@ -175,7 +176,7 @@ def execute(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( object_type=dict(type='str', required=True, choices=[ 'Datacenter', diff --git a/plugins/modules/vmware_object_role_permission.py b/plugins/modules/vmware_object_role_permission.py index f05a3a5ff..20591b2d4 100644 --- a/plugins/modules/vmware_object_role_permission.py +++ b/plugins/modules/vmware_object_role_permission.py @@ -68,7 +68,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -144,7 +144,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, find_obj +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareObjectRolePermission(PyVmomi): @@ -300,7 +301,7 @@ def get_object(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( role=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_object_role_permission_info.py b/plugins/modules/vmware_object_role_permission_info.py index d6049ad7b..f324ed0f2 100644 --- a/plugins/modules/vmware_object_role_permission_info.py +++ b/plugins/modules/vmware_object_role_permission_info.py @@ -51,7 +51,7 @@ aliases: ['object_moid'] type: 'str' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ EXAMPLES = r""" @@ -98,9 +98,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, find_obj, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareObjectRolePermission(PyVmomi): @@ -227,7 +227,7 @@ def get_object(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( principal=dict( diff --git a/plugins/modules/vmware_portgroup.py b/plugins/modules/vmware_portgroup.py index c4e569b87..96f9c41c4 100644 --- a/plugins/modules/vmware_portgroup.py +++ b/plugins/modules/vmware_portgroup.py @@ -139,7 +139,7 @@ default: present type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -263,7 +263,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -971,7 +972,7 @@ def create_nic_failure_policy(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( portgroup=dict(type='str', required=True, aliases=['portgroup_name']), switch=dict(type='str', required=True, aliases=['switch_name', 'vswitch']), diff --git a/plugins/modules/vmware_portgroup_info.py b/plugins/modules/vmware_portgroup_info.py index 6d3fa00ab..a2d8bda19 100644 --- a/plugins/modules/vmware_portgroup_info.py +++ b/plugins/modules/vmware_portgroup_info.py @@ -38,7 +38,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -98,7 +98,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class PortgroupInfoManager(PyVmomi): @@ -194,7 +195,7 @@ def gather_host_portgroup_info(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_recommended_datastore.py b/plugins/modules/vmware_recommended_datastore.py index 2bf9f30f5..311622207 100644 --- a/plugins/modules/vmware_recommended_datastore.py +++ b/plugins/modules/vmware_recommended_datastore.py @@ -34,7 +34,7 @@ type: str required: true extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ @@ -64,8 +64,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDatastoreClusterInfo(PyVmomi): @@ -94,7 +94,7 @@ def __init__(self, module): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type="str", required=True), datastore_cluster=dict(type="str", required=True), diff --git a/plugins/modules/vmware_resource_pool.py b/plugins/modules/vmware_resource_pool.py index 319542c54..6b468b6bd 100644 --- a/plugins/modules/vmware_resource_pool.py +++ b/plugins/modules/vmware_resource_pool.py @@ -120,7 +120,7 @@ - 'absent' type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -197,8 +197,9 @@ HAS_PYVMOMI = False from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import get_all_objs, vmware_argument_spec, find_datacenter_by_name, \ +from ansible_collections.community.vmware.plugins.module_utils.vmware import get_all_objs, find_datacenter_by_name, \ find_cluster_by_name, find_object_by_name, wait_for_task, find_resource_pool_by_name, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -444,7 +445,7 @@ def check_rp_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(datacenter=dict(required=True, type='str'), cluster=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_resource_pool_info.py b/plugins/modules/vmware_resource_pool_info.py index 82765a3b0..3a4f71c7a 100644 --- a/plugins/modules/vmware_resource_pool_info.py +++ b/plugins/modules/vmware_resource_pool_info.py @@ -18,7 +18,7 @@ author: - Abhijeet Kasurde (@Akasurde) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -76,7 +76,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, get_all_objs +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class ResourcePoolInfoManager(PyVmomi): @@ -122,7 +123,7 @@ def gather_rp_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) vmware_rp_mgr = ResourcePoolInfoManager(module) diff --git a/plugins/modules/vmware_sdrs_vm_overrides_info.py b/plugins/modules/vmware_sdrs_vm_overrides_info.py index 38f72d683..be6cdaf40 100644 --- a/plugins/modules/vmware_sdrs_vm_overrides_info.py +++ b/plugins/modules/vmware_sdrs_vm_overrides_info.py @@ -25,7 +25,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options """ @@ -62,8 +62,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareDatastoreClusterManager(PyVmomi): @@ -98,7 +98,7 @@ def check_vm_overrides(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datastore_cluster_name=dict(type="str", required=True), diff --git a/plugins/modules/vmware_target_canonical_info.py b/plugins/modules/vmware_target_canonical_info.py index 8ba7cfbbe..557a7dc16 100644 --- a/plugins/modules/vmware_target_canonical_info.py +++ b/plugins/modules/vmware_target_canonical_info.py @@ -39,7 +39,7 @@ - This parameter is required, if O(cluster_name) is not provided. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -104,7 +104,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class ScsiTargetInfoManager(PyVmomi): @@ -152,7 +153,7 @@ def gather_scsi_device_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( target_id=dict(required=False, type='int'), diff --git a/plugins/modules/vmware_vasa.py b/plugins/modules/vmware_vasa.py index 405cc795a..67bc17380 100644 --- a/plugins/modules/vmware_vasa.py +++ b/plugins/modules/vmware_vasa.py @@ -54,7 +54,7 @@ seealso: - module: community.vmware.vmware_vasa_info extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -93,7 +93,7 @@ SMS, TaskError, wait_for_sms_task) -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -232,7 +232,7 @@ def check_vasa_configuration(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( vasa_name=dict(type='str', required=True), vasa_url=dict(type='str', required=True), diff --git a/plugins/modules/vmware_vasa_info.py b/plugins/modules/vmware_vasa_info.py index 5d182cf1b..3c5dcb72a 100644 --- a/plugins/modules/vmware_vasa_info.py +++ b/plugins/modules/vmware_vasa_info.py @@ -20,7 +20,7 @@ author: - Eugenio Grosso (@genegr) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -63,7 +63,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_sms import SMS -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class SMSClient(SMS): @@ -104,7 +104,7 @@ def get_vasa_provider_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/vmware_vcenter_settings.py b/plugins/modules/vmware_vcenter_settings.py index eb7709f86..3c55567f3 100644 --- a/plugins/modules/vmware_vcenter_settings.py +++ b/plugins/modules/vmware_vcenter_settings.py @@ -228,7 +228,7 @@ default: {} type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -397,7 +397,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, option_diff, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, option_diff +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -858,7 +859,7 @@ def ensure(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( database=dict( type='dict', diff --git a/plugins/modules/vmware_vcenter_settings_info.py b/plugins/modules/vmware_vcenter_settings_info.py index 183a58244..dc30328bd 100644 --- a/plugins/modules/vmware_vcenter_settings_info.py +++ b/plugins/modules/vmware_vcenter_settings_info.py @@ -37,7 +37,7 @@ type: list elements: str extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options """ EXAMPLES = r""" @@ -105,8 +105,8 @@ from ansible_collections.community.vmware.plugins.module_utils.vmware import ( PyVmomi, - vmware_argument_spec, ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils.basic import AnsibleModule @@ -193,7 +193,7 @@ def ensure(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( schema=dict(type="str", choices=["summary", "vsphere"], default="summary"), properties=dict(type="list", elements="str"), diff --git a/plugins/modules/vmware_vcenter_statistics.py b/plugins/modules/vmware_vcenter_statistics.py index ad3821d1c..efecfae6b 100644 --- a/plugins/modules/vmware_vcenter_statistics.py +++ b/plugins/modules/vmware_vcenter_statistics.py @@ -116,7 +116,7 @@ default: 1 type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -177,7 +177,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -464,7 +465,7 @@ def update_perf_interval(self, perf_manager, statistic): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( interval_past_day=dict( type='dict', diff --git a/plugins/modules/vmware_vm_config_option.py b/plugins/modules/vmware_vm_config_option.py index 9201d2724..eee06fe64 100644 --- a/plugins/modules/vmware_vm_config_option.py +++ b/plugins/modules/vmware_vm_config_option.py @@ -69,7 +69,7 @@ - The hardware version from the returned list when O(get_hardware_versions=true), e.g., 'vmx-19'. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -111,7 +111,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import find_obj, vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import find_obj, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vm_device_helper import PyVmomiDeviceHelper @@ -289,7 +290,7 @@ def get_config_option_for_guest(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(type='str', default='ha-datacenter'), cluster_name=dict(type='str'), diff --git a/plugins/modules/vmware_vm_host_drs_rule.py b/plugins/modules/vmware_vm_host_drs_rule.py index a63f5f5c2..4442ea22a 100644 --- a/plugins/modules/vmware_vm_host_drs_rule.py +++ b/plugins/modules/vmware_vm_host_drs_rule.py @@ -16,7 +16,7 @@ description: - "This module can be used to create VM-Host rules in a given cluster." extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options module: vmware_vm_host_drs_rule options: @@ -106,8 +106,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, vmware_argument_spec, wait_for_task, find_cluster_by_name, + PyVmomi, wait_for_task, find_cluster_by_name, find_datacenter_by_name) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareVmHostRuleDrs(PyVmomi): @@ -377,7 +378,7 @@ def delete(self, rule_name=None): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( state=dict(type='str', default='present', choices=['absent', 'present']), diff --git a/plugins/modules/vmware_vm_info.py b/plugins/modules/vmware_vm_info.py index 7e16e6009..b2cc87dde 100644 --- a/plugins/modules/vmware_vm_info.py +++ b/plugins/modules/vmware_vm_info.py @@ -113,7 +113,7 @@ - Name of the virtual machine to get related configurations information from. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -289,7 +289,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, \ - get_all_objs, vmware_argument_spec, _get_vm_prop, get_parent_datacenter, find_vm_by_name + get_all_objs, _get_vm_prop, get_parent_datacenter, find_vm_by_name +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -449,7 +450,7 @@ def get_virtual_machines(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( vm_type=dict(type='str', choices=['vm', 'all', 'template'], default='all'), show_attribute=dict(type='bool', default='no'), diff --git a/plugins/modules/vmware_vm_shell.py b/plugins/modules/vmware_vm_shell.py index 89163e139..91ff17aea 100644 --- a/plugins/modules/vmware_vm_shell.py +++ b/plugins/modules/vmware_vm_shell.py @@ -103,7 +103,7 @@ default: 3600 type: int extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -199,8 +199,8 @@ from ansible.module_utils._text import to_native from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, find_cluster_by_name, find_datacenter_by_name, find_vm_by_id, - vmware_argument_spec) + PyVmomi, find_cluster_by_name, find_datacenter_by_name, find_vm_by_id) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareShellManager(PyVmomi): @@ -329,7 +329,7 @@ def wait_for_process(self, vm, pid, creds): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( datacenter=dict(type='str'), diff --git a/plugins/modules/vmware_vm_storage_policy.py b/plugins/modules/vmware_vm_storage_policy.py index 7f8eed013..58858927d 100644 --- a/plugins/modules/vmware_vm_storage_policy.py +++ b/plugins/modules/vmware_vm_storage_policy.py @@ -62,7 +62,7 @@ choices: [ absent, present ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -110,7 +110,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_spbm import SPBM -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient @@ -341,7 +341,7 @@ def ensure_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( name=dict(type='str', required=True), description=dict(type='str', required=False), diff --git a/plugins/modules/vmware_vm_storage_policy_info.py b/plugins/modules/vmware_vm_storage_policy_info.py index 7f2873998..4e893df9c 100644 --- a/plugins/modules/vmware_vm_storage_policy_info.py +++ b/plugins/modules/vmware_vm_storage_policy_info.py @@ -21,7 +21,7 @@ author: - Abhijeet Kasurde (@Akasurde) extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -83,7 +83,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_spbm import SPBM -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class SPBMClient(SPBM): @@ -149,7 +149,7 @@ def get_storage_policy_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/vmware_vm_vm_drs_rule.py b/plugins/modules/vmware_vm_vm_drs_rule.py index e7e44cea1..f06bf88cf 100644 --- a/plugins/modules/vmware_vm_vm_drs_rule.py +++ b/plugins/modules/vmware_vm_vm_drs_rule.py @@ -69,7 +69,7 @@ choices: [ present, absent ] type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -144,8 +144,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, vmware_argument_spec, wait_for_task, + PyVmomi, wait_for_task, find_vm_by_id, find_cluster_by_name, find_datacenter_by_name) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmwareDrs(PyVmomi): @@ -367,7 +368,7 @@ def delete(self, rule_name=None): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( state=dict(type='str', default='present', choices=['absent', 'present']), vms=dict(type='list', elements='str'), diff --git a/plugins/modules/vmware_vm_vss_dvs_migrate.py b/plugins/modules/vmware_vm_vss_dvs_migrate.py index 8fd62553e..fb74cc3ac 100644 --- a/plugins/modules/vmware_vm_vss_dvs_migrate.py +++ b/plugins/modules/vmware_vm_vss_dvs_migrate.py @@ -29,7 +29,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -53,7 +53,8 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( HAS_PYVMOMI, connect_to_api, get_all_objs, - vmware_argument_spec, wait_for_task) + wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareVmVssDvsMigrate(object): @@ -135,7 +136,7 @@ def check_vm_network_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(vm_name=dict(required=True, type='str'), dvportgroup_name=dict(required=True, type='str'))) diff --git a/plugins/modules/vmware_vmkernel.py b/plugins/modules/vmware_vmkernel.py index 26dbe7b2b..24713aea3 100644 --- a/plugins/modules/vmware_vmkernel.py +++ b/plugins/modules/vmware_vmkernel.py @@ -161,7 +161,7 @@ required: true type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -281,9 +281,10 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - PyVmomi, TaskError, vmware_argument_spec, wait_for_task, + PyVmomi, TaskError, wait_for_task, find_dvspg_by_name, find_dvs_by_name, get_all_objs ) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -1090,7 +1091,7 @@ def get_api_net_stack_instance(tcpip_stack): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( esxi_hostname=dict(required=True, type='str'), portgroup_name=dict(required=True, type='str', aliases=['portgroup']), diff --git a/plugins/modules/vmware_vmkernel_info.py b/plugins/modules/vmware_vmkernel_info.py index 9638397dc..2e57ce74f 100644 --- a/plugins/modules/vmware_vmkernel_info.py +++ b/plugins/modules/vmware_vmkernel_info.py @@ -31,7 +31,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -89,7 +89,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -173,7 +174,7 @@ def gather_host_vmk_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vmware_vmotion.py b/plugins/modules/vmware_vmotion.py index 786684925..7d9bafa0d 100644 --- a/plugins/modules/vmware_vmotion.py +++ b/plugins/modules/vmware_vmotion.py @@ -84,7 +84,7 @@ default: 3600 version_added: '3.4.0' extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -177,7 +177,8 @@ find_resource_pool_by_name, find_datacenter_by_name, find_cluster_by_name, get_all_objs, - vmware_argument_spec, wait_for_task, TaskError) + wait_for_task, TaskError) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VmotionManager(PyVmomi): @@ -523,7 +524,7 @@ def get_vm(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( dict( vm_name=dict(aliases=['vm']), diff --git a/plugins/modules/vmware_vsan_cluster.py b/plugins/modules/vmware_vsan_cluster.py index 451f801d5..ae6e0781d 100644 --- a/plugins/modules/vmware_vsan_cluster.py +++ b/plugins/modules/vmware_vsan_cluster.py @@ -24,7 +24,7 @@ required: false type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -60,8 +60,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - HAS_PYVMOMI, connect_to_api, get_all_objs, vmware_argument_spec, + HAS_PYVMOMI, connect_to_api, get_all_objs, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec def create_vsan_cluster(host_system, new_cluster_uuid): @@ -89,7 +90,7 @@ def create_vsan_cluster(host_system, new_cluster_uuid): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict(cluster_uuid=dict(required=False, type='str'))) module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False) diff --git a/plugins/modules/vmware_vsan_hcl_db.py b/plugins/modules/vmware_vsan_hcl_db.py index 6f0100330..625a4bc48 100644 --- a/plugins/modules/vmware_vsan_hcl_db.py +++ b/plugins/modules/vmware_vsan_hcl_db.py @@ -29,7 +29,7 @@ type: str required: true extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -65,7 +65,8 @@ HAS_VSANPYTHONSDK = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VsanApi(PyVmomi): @@ -85,7 +86,7 @@ def upload_hcl_db(self, content): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( source=dict(type='str', required=True) diff --git a/plugins/modules/vmware_vsan_health_info.py b/plugins/modules/vmware_vsan_health_info.py index 7a6b68735..6bb6b07ad 100644 --- a/plugins/modules/vmware_vsan_health_info.py +++ b/plugins/modules/vmware_vsan_health_info.py @@ -35,7 +35,7 @@ requirements: - VMware vSAN Python's SDK extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options author: - Erwan Quelin (@equelin) ''' @@ -121,7 +121,8 @@ HAS_VSANPYTHONSDK = False from ansible.module_utils.basic import AnsibleModule, missing_required_lib -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VSANInfoManager(PyVmomi): @@ -169,7 +170,7 @@ def gather_info(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( datacenter=dict(required=False, type='str', aliases=['datacenter_name']), cluster_name=dict(required=True, type='str'), diff --git a/plugins/modules/vmware_vsan_release_catalog.py b/plugins/modules/vmware_vsan_release_catalog.py index 14a464f2e..b9db1ff63 100644 --- a/plugins/modules/vmware_vsan_release_catalog.py +++ b/plugins/modules/vmware_vsan_release_catalog.py @@ -29,7 +29,7 @@ type: str required: true extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -56,7 +56,8 @@ HAS_VSANPYTHONSDK = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VsanApi(PyVmomi): @@ -74,7 +75,7 @@ def upload_release_catalog(self, content): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( source=dict(type='str', required=True) diff --git a/plugins/modules/vmware_vspan_session.py b/plugins/modules/vmware_vspan_session.py index d69830f8d..5ffef6500 100644 --- a/plugins/modules/vmware_vspan_session.py +++ b/plugins/modules/vmware_vspan_session.py @@ -161,7 +161,7 @@ required: false type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -217,8 +217,9 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware import ( - vmware_argument_spec, PyVmomi, find_dvs_by_name, + PyVmomi, find_dvs_by_name, find_vm_by_name, wait_for_task) +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VMwareVspanSession(PyVmomi): @@ -613,7 +614,7 @@ def add_vspan_session(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( switch=dict(type='str', required=True, aliases=['switch_name']), name=dict(type='str', required=True), diff --git a/plugins/modules/vmware_vswitch.py b/plugins/modules/vmware_vswitch.py index 619eb5af7..483344ba3 100644 --- a/plugins/modules/vmware_vswitch.py +++ b/plugins/modules/vmware_vswitch.py @@ -129,7 +129,7 @@ required: false type: dict extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -248,7 +248,8 @@ pass from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec from ansible.module_utils._text import to_native @@ -735,7 +736,7 @@ def update_traffic_shaping_policy(self, spec, results): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( switch=dict(type='str', required=True, aliases=['switch_name']), nics=dict(type='list', aliases=['nic_name'], default=[], elements='str'), diff --git a/plugins/modules/vmware_vswitch_info.py b/plugins/modules/vmware_vswitch_info.py index ff21a7958..020b9e4d2 100644 --- a/plugins/modules/vmware_vswitch_info.py +++ b/plugins/modules/vmware_vswitch_info.py @@ -39,7 +39,7 @@ - If O(cluster_name) is not given, this parameter is required. type: str extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -106,7 +106,8 @@ ''' from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec, PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VswitchInfoManager(PyVmomi): @@ -183,7 +184,7 @@ def gather_vswitch_info(self): def main(): """Main""" - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update( cluster_name=dict(type='str', required=False), esxi_hostname=dict(type='str', required=False), diff --git a/plugins/modules/vsan_health_silent_checks.py b/plugins/modules/vsan_health_silent_checks.py index eaa6b240a..d8f7a5304 100644 --- a/plugins/modules/vsan_health_silent_checks.py +++ b/plugins/modules/vsan_health_silent_checks.py @@ -43,7 +43,7 @@ choices: [ 'present', 'absent' ] type: str extends_documentation_fragment: - - community.vmware.vmware.documentation + - community.vmware.base_options ''' EXAMPLES = r''' @@ -84,7 +84,8 @@ HAS_VSANPYTHONSDK = False from ansible.module_utils.basic import AnsibleModule -from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec class VsanApi(PyVmomi): @@ -127,7 +128,7 @@ def process_state(self): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( checks=dict(type='list', elements='str', required=False), diff --git a/plugins/modules/vsphere_copy.py b/plugins/modules/vsphere_copy.py index 670a8e86a..87206026e 100644 --- a/plugins/modules/vsphere_copy.py +++ b/plugins/modules/vsphere_copy.py @@ -58,7 +58,7 @@ - "This module ought to be run from a system that can access the vCenter or the ESXi directly and has the file to transfer. It can be the normal remote target or you can change it either by using C(transport: local) or using C(delegate_to)." extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' @@ -121,7 +121,7 @@ from ansible.module_utils.six.moves.urllib.parse import urlencode, quote from ansible.module_utils._text import to_native from ansible.module_utils.urls import open_url -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec def vmware_path(datastore, datacenter, path, diskformat): @@ -142,7 +142,7 @@ def vmware_path(datastore, datacenter, path, diskformat): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( src=dict(required=True, aliases=['name']), datacenter=dict(required=False), diff --git a/plugins/modules/vsphere_file.py b/plugins/modules/vsphere_file.py index 42ddc9b61..eb06116a3 100644 --- a/plugins/modules/vsphere_file.py +++ b/plugins/modules/vsphere_file.py @@ -52,7 +52,7 @@ notes: - The vSphere folder API does not allow to remove directory objects. extends_documentation_fragment: -- community.vmware.vmware.documentation +- community.vmware.base_options ''' EXAMPLES = r''' @@ -114,7 +114,7 @@ from ansible.module_utils.six.moves.urllib.parse import quote, urlencode from ansible.module_utils.urls import open_url from ansible.module_utils._text import to_native -from ansible_collections.community.vmware.plugins.module_utils.vmware import vmware_argument_spec +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import base_argument_spec def vmware_path(datastore, datacenter, path): @@ -133,7 +133,7 @@ def vmware_path(datastore, datacenter, path): def main(): - argument_spec = vmware_argument_spec() + argument_spec = base_argument_spec() argument_spec.update(dict( datacenter=dict(type='str', required=True), From 7df66e510e43d60bfb0479fe62d488b5db9a2916 Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Mon, 16 Dec 2024 07:39:37 +0100 Subject: [PATCH 3/4] REST stuff and removing old docs fragments --- plugins/doc_fragments/vmware.py | 111 ------------------ plugins/doc_fragments/vmware_rest_client.py | 68 ----------- plugins/module_utils/vmware_rest_client.py | 33 +----- plugins/modules/vmware_category.py | 6 +- plugins/modules/vmware_category_info.py | 6 +- .../vmware_content_deploy_ovf_template.py | 7 +- .../modules/vmware_content_deploy_template.py | 6 +- .../modules/vmware_content_library_info.py | 6 +- .../modules/vmware_content_library_manager.py | 6 +- plugins/modules/vmware_object_rename.py | 6 +- plugins/modules/vmware_tag.py | 6 +- plugins/modules/vmware_tag_info.py | 6 +- plugins/modules/vmware_tag_manager.py | 6 +- .../modules/vmware_vc_infraprofile_info.py | 6 +- 14 files changed, 46 insertions(+), 233 deletions(-) delete mode 100644 plugins/doc_fragments/vmware.py delete mode 100644 plugins/doc_fragments/vmware_rest_client.py diff --git a/plugins/doc_fragments/vmware.py b/plugins/doc_fragments/vmware.py deleted file mode 100644 index 18fe01972..000000000 --- a/plugins/doc_fragments/vmware.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright: (c) 2016, Charles Paul -# Copyright: (c) 2018, Ansible Project -# Copyright: (c) 2019, Abhijeet Kasurde -# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) -# SPDX-License-Identifier: GPL-3.0-or-later - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -class ModuleDocFragment(object): - # Parameters for VMware modules - DOCUMENTATION = r''' -notes: - - All modules requires API write access and hence is not supported on a free ESXi license. - - All variables and VMware object names are case sensitive. -options: - hostname: - description: - - The hostname or IP address of the vSphere vCenter or ESXi server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. - type: str - username: - description: - - The username of the vSphere vCenter or ESXi server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. - type: str - aliases: [ admin, user ] - password: - description: - - The password of the vSphere vCenter or ESXi server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. - type: str - aliases: [ pass, pwd ] - validate_certs: - description: - - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. - - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. - type: bool - default: true - port: - description: - - The port number of the vSphere vCenter or ESXi server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. - type: int - default: 443 - proxy_host: - description: - - Address of a proxy that will receive all HTTPS requests and relay them. - - The format is a hostname or a IP. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. - type: str - required: false - proxy_port: - description: - - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. - type: int - required: false -''' - - # This doc fragment is specific to vcenter modules like vcenter_license - VCENTER_DOCUMENTATION = r''' -notes: - - All modules requires API write access and hence is not supported on a free ESXi license. -options: - hostname: - description: - - The hostname or IP address of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. - type: str - username: - description: - - The username of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. - type: str - aliases: [ admin, user ] - password: - description: - - The password of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. - type: str - aliases: [ pass, pwd ] - validate_certs: - description: - - Allows connection when SSL certificates are not valid. Set to V(false) when certificates are not trusted. - - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. - type: bool - default: true - port: - description: - - The port number of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. - type: int - default: 443 - proxy_host: - description: - - Address of a proxy that will receive all HTTPS requests and relay them. - - The format is a hostname or a IP. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. - type: str - required: false - proxy_port: - description: - - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. - type: int - required: false - ''' diff --git a/plugins/doc_fragments/vmware_rest_client.py b/plugins/doc_fragments/vmware_rest_client.py deleted file mode 100644 index 50af0ba50..000000000 --- a/plugins/doc_fragments/vmware_rest_client.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright: (c) 2018, Ansible Project -# Copyright: (c) 2018, Abhijeet Kasurde -# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) -# SPDX-License-Identifier: GPL-3.0-or-later - -from __future__ import absolute_import, division, print_function -__metaclass__ = type - - -class ModuleDocFragment(object): - # Parameters for VMware REST Client based modules - DOCUMENTATION = r''' -notes: - - All modules requires API write access and hence is not supported on a free ESXi license. - - All variables and VMware object names are case sensitive. -options: - hostname: - description: - - The hostname or IP address of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_HOST) will be used instead. - type: str - username: - description: - - The username of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_USER) will be used instead. - type: str - aliases: [ admin, user ] - password: - description: - - The password of the vSphere vCenter server. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PASSWORD) will be used instead. - type: str - aliases: [ pass, pwd ] - validate_certs: - description: - - Allows connection when SSL certificates are not valid. - - Set to V(false) when certificates are not trusted. - - If the value is not specified in the task, the value of environment variable E(VMWARE_VALIDATE_CERTS) will be used instead. - type: bool - default: true - port: - description: - - The port number of the vSphere vCenter. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PORT) will be used instead. - type: int - default: 443 - protocol: - description: - - The connection to protocol. - type: str - choices: [ http, https ] - default: https - proxy_host: - description: - - Address of a proxy that will receive all HTTPS requests and relay them. - - The format is a hostname or a IP. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_HOST) will be used instead. - type: str - required: false - proxy_port: - description: - - Port of the HTTP proxy that will receive all HTTPS requests and relay them. - - If the value is not specified in the task, the value of environment variable E(VMWARE_PROXY_PORT) will be used instead. - type: int - required: false -''' diff --git a/plugins/module_utils/vmware_rest_client.py b/plugins/module_utils/vmware_rest_client.py index c51e3ad18..046fcdbaa 100644 --- a/plugins/module_utils/vmware_rest_client.py +++ b/plugins/module_utils/vmware_rest_client.py @@ -54,7 +54,7 @@ except ImportError: HAS_URLLIB3 = False -from ansible.module_utils.basic import env_fallback, missing_required_lib +from ansible.module_utils.basic import missing_required_lib from ansible.module_utils._text import to_native @@ -102,37 +102,6 @@ def check_required_library(self): url='https://code.vmware.com/web/sdk/7.0/vsphere-automation-python'), exception=VSPHERE_IMP_ERR) - @staticmethod - def vmware_client_argument_spec(): - return dict( - hostname=dict(type='str', - fallback=(env_fallback, ['VMWARE_HOST'])), - username=dict(type='str', - fallback=(env_fallback, ['VMWARE_USER']), - aliases=['user', 'admin']), - password=dict(type='str', - fallback=(env_fallback, ['VMWARE_PASSWORD']), - aliases=['pass', 'pwd'], - no_log=True), - port=dict(type='int', - default=443, - fallback=(env_fallback, ['VMWARE_PORT'])), - protocol=dict(type='str', - default='https', - choices=['https', 'http']), - validate_certs=dict(type='bool', - fallback=(env_fallback, ['VMWARE_VALIDATE_CERTS']), - default=True), - proxy_host=dict(type='str', - required=False, - default=None, - fallback=(env_fallback, ['VMWARE_PROXY_HOST'])), - proxy_port=dict(type='int', - required=False, - default=None, - fallback=(env_fallback, ['VMWARE_PROXY_PORT'])), - ) - def connect_to_vsphere_client(self): """ Connect to vSphere API Client with Username and Password diff --git a/plugins/modules/vmware_category.py b/plugins/modules/vmware_category.py index 6e76a8b97..1f15e7f3d 100644 --- a/plugins/modules/vmware_category.py +++ b/plugins/modules/vmware_category.py @@ -87,7 +87,8 @@ type: list elements: str extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -157,6 +158,7 @@ from ansible.module_utils.compat.version import LooseVersion from ansible_collections.community.vmware.plugins.module_utils.vmware import connect_to_api from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec try: from pyVmomi.VmomiSupport import XMLNS_VMODL_BASE @@ -354,7 +356,7 @@ def get_all_categories(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( category_name=dict(type='str', required=True), category_description=dict(type='str', default='', required=False), diff --git a/plugins/modules/vmware_category_info.py b/plugins/modules/vmware_category_info.py index 71d228f83..20a6bb4f6 100644 --- a/plugins/modules/vmware_category_info.py +++ b/plugins/modules/vmware_category_info.py @@ -22,7 +22,8 @@ requirements: - vSphere Automation SDK extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -81,6 +82,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec class VmwareCategoryInfoManager(VmwareRestClient): @@ -108,7 +110,7 @@ def get_all_tag_categories(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) vmware_category_info = VmwareCategoryInfoManager(module) diff --git a/plugins/modules/vmware_content_deploy_ovf_template.py b/plugins/modules/vmware_content_deploy_ovf_template.py index f2a76bab2..ac481a5d8 100644 --- a/plugins/modules/vmware_content_deploy_ovf_template.py +++ b/plugins/modules/vmware_content_deploy_ovf_template.py @@ -87,7 +87,9 @@ type: str default: 'thin' choices: [ thin, thick, eagerZeroedThick, eagerzeroedthick ] -extends_documentation_fragment: community.vmware.vmware_rest_client.documentation +extends_documentation_fragment: +- community.vmware.base_options +- community.vmware.additional_rest_options ''' EXAMPLES = r''' @@ -133,6 +135,7 @@ from ansible.module_utils.basic import AnsibleModule, env_fallback from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi HAS_VAUTOMATION = False @@ -337,7 +340,7 @@ def _exit(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( log_level=dict( type='str', diff --git a/plugins/modules/vmware_content_deploy_template.py b/plugins/modules/vmware_content_deploy_template.py index 31050a84a..c576bbbde 100644 --- a/plugins/modules/vmware_content_deploy_template.py +++ b/plugins/modules/vmware_content_deploy_template.py @@ -107,7 +107,8 @@ default: 'present' choices: [ 'present', 'poweredon' ] extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -155,6 +156,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi from ansible.module_utils._text import to_native @@ -347,7 +349,7 @@ def _exit(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( log_level=dict( type='str', diff --git a/plugins/modules/vmware_content_library_info.py b/plugins/modules/vmware_content_library_info.py index abd3d0a44..369aa0ba9 100644 --- a/plugins/modules/vmware_content_library_info.py +++ b/plugins/modules/vmware_content_library_info.py @@ -29,7 +29,8 @@ type: str required: false extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -85,6 +86,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec class VmwareContentLibInfo(VmwareRestClient): @@ -149,7 +151,7 @@ def get_content_lib_details(self, library_id): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( library_id=dict(type='str', required=False), ) diff --git a/plugins/modules/vmware_content_library_manager.py b/plugins/modules/vmware_content_library_manager.py index 38ba6ba42..ca8b45825 100644 --- a/plugins/modules/vmware_content_library_manager.py +++ b/plugins/modules/vmware_content_library_manager.py @@ -92,7 +92,8 @@ default: 'present' choices: [ 'present', 'absent' ] extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' EXAMPLES = r''' @@ -159,6 +160,7 @@ import uuid from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi HAS_VAUTOMATION_PYTHON_SDK = False @@ -410,7 +412,7 @@ def state_destroy_library(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( library_name=dict(type='str', required=True), library_description=dict(type='str', required=False), diff --git a/plugins/modules/vmware_object_rename.py b/plugins/modules/vmware_object_rename.py index 6b5be8471..d45f60082 100644 --- a/plugins/modules/vmware_object_rename.py +++ b/plugins/modules/vmware_object_rename.py @@ -54,7 +54,8 @@ aliases: ['object_new_name'] type: str extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' EXAMPLES = r''' @@ -124,6 +125,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi, wait_for_task try: from pyVmomi import vim @@ -307,7 +309,7 @@ def ensure_state(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( object_name=dict(), object_moid=dict(), diff --git a/plugins/modules/vmware_tag.py b/plugins/modules/vmware_tag.py index fdb33c811..31eab773c 100644 --- a/plugins/modules/vmware_tag.py +++ b/plugins/modules/vmware_tag.py @@ -65,7 +65,8 @@ choices: [ 'present', 'absent' ] type: str extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -114,6 +115,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec try: from com.vmware.vapi.std.errors_client import Error except ImportError: @@ -239,7 +241,7 @@ def check_tag_status(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( tag_name=dict(type='str', aliases=['tag', 'name'], required=True), tag_description=dict(type='str', aliases=['description'], default='', required=False), diff --git a/plugins/modules/vmware_tag_info.py b/plugins/modules/vmware_tag_info.py index fcc545576..365a36631 100644 --- a/plugins/modules/vmware_tag_info.py +++ b/plugins/modules/vmware_tag_info.py @@ -22,7 +22,8 @@ requirements: - vSphere Automation SDK extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -113,6 +114,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec class VmTagInfoManager(VmwareRestClient): @@ -152,7 +154,7 @@ def get_all_tags(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) diff --git a/plugins/modules/vmware_tag_manager.py b/plugins/modules/vmware_tag_manager.py index d78a5a3dc..4824cffec 100644 --- a/plugins/modules/vmware_tag_manager.py +++ b/plugins/modules/vmware_tag_manager.py @@ -71,7 +71,8 @@ required: false type: str extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' @@ -187,6 +188,7 @@ ''' from ansible.module_utils.basic import AnsibleModule from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import (PyVmomi, find_dvs_by_name, find_dvspg_by_name) try: from com.vmware.vapi.std_client import DynamicID @@ -394,7 +396,7 @@ def ensure_state(self): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( tag_names=dict(type='list', required=True, elements='raw'), state=dict(type='str', choices=['absent', 'add', 'present', 'remove', 'set'], default='add'), diff --git a/plugins/modules/vmware_vc_infraprofile_info.py b/plugins/modules/vmware_vc_infraprofile_info.py index af5594416..94b497b74 100644 --- a/plugins/modules/vmware_vc_infraprofile_info.py +++ b/plugins/modules/vmware_vc_infraprofile_info.py @@ -56,7 +56,8 @@ type: str required: false extends_documentation_fragment: -- community.vmware.vmware_rest_client.documentation +- community.vmware.base_options +- community.vmware.additional_rest_options ''' EXAMPLES = r''' @@ -148,6 +149,7 @@ from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.compat.version import LooseVersion from ansible_collections.community.vmware.plugins.module_utils.vmware_rest_client import VmwareRestClient +from ansible_collections.community.vmware.plugins.module_utils.vmware_argument_spec import rest_compatible_argument_spec from ansible_collections.community.vmware.plugins.module_utils.vmware import PyVmomi import json import time @@ -232,7 +234,7 @@ def wait_for_task(self, task, poll_interval=1): def main(): - argument_spec = VmwareRestClient.vmware_client_argument_spec() + argument_spec = rest_compatible_argument_spec() argument_spec.update( encryption_key=dict(type='str', required=False, no_log=True), description=dict(type='str', required=False), From 633bb9418c4a93439a217dfef88b45e87ce52e2b Mon Sep 17 00:00:00 2001 From: Mario Lenz Date: Mon, 16 Dec 2024 07:56:12 +0100 Subject: [PATCH 4/4] Some fixes --- plugins/modules/vcenter_license.py | 2 +- plugins/modules/vmware_first_class_disk.py | 2 +- plugins/modules/vmware_first_class_disk_info.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/modules/vcenter_license.py b/plugins/modules/vcenter_license.py index 97454caca..2534ae28c 100644 --- a/plugins/modules/vcenter_license.py +++ b/plugins/modules/vcenter_license.py @@ -59,7 +59,7 @@ - If O(esxi_hostname) is not specified, then will just register the O(license) key to vCenter inventory without assigning it to an ESXi host. extends_documentation_fragment: -- community.vmware.vmware.vcenter_documentation +- community.vmware.base_options ''' diff --git a/plugins/modules/vmware_first_class_disk.py b/plugins/modules/vmware_first_class_disk.py index 6207b6f6b..2eb4706cd 100644 --- a/plugins/modules/vmware_first_class_disk.py +++ b/plugins/modules/vmware_first_class_disk.py @@ -44,7 +44,7 @@ choices: [ present, absent ] default: present type: str -extends_documentation_fragment: vmware.documentation +extends_documentation_fragment: community.vmware.base_options ''' EXAMPLES = r''' diff --git a/plugins/modules/vmware_first_class_disk_info.py b/plugins/modules/vmware_first_class_disk_info.py index d7835bd0d..af6f24e1a 100644 --- a/plugins/modules/vmware_first_class_disk_info.py +++ b/plugins/modules/vmware_first_class_disk_info.py @@ -28,7 +28,7 @@ disk_name: description: The name of the disk. If not set return all found. type: str -extends_documentation_fragment: vmware.documentation +extends_documentation_fragment: community.vmware.base_options ''' EXAMPLES = r'''