Skip to content

Commit

Permalink
Next batch of changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mariolenz committed Dec 15, 2024
1 parent e4af855 commit 450df28
Show file tree
Hide file tree
Showing 166 changed files with 620 additions and 527 deletions.
34 changes: 0 additions & 34 deletions plugins/module_utils/vmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vcenter_domain_user_group_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
type: bool
default: true
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

EXAMPLES = r'''
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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),
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vcenter_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
default: present
type: str
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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),
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vcenter_extension_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
author:
- Abhijeet Kasurde (@Akasurde)
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vcenter_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
choices: [ present, absent ]
type: str
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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),
Expand Down
5 changes: 3 additions & 2 deletions plugins/modules/vcenter_license.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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),
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/vcenter_root_password_expiration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
type: int
required: false
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

EXAMPLES = r'''
Expand All @@ -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
Expand Down Expand Up @@ -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',
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vcenter_standard_key_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'''
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vmware_about_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
author:
- Abhijeet Kasurde (@Akasurde)
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/vmware_all_snapshots_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
choices: ['exact', 'includes']
default: exact
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

EXAMPLES = r'''
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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={}),
Expand Down
7 changes: 4 additions & 3 deletions plugins/modules/vmware_cfg_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
type: str
required: true
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'),
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/vmware_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''

Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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']),
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/vmware_cluster_dpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
default: 3
choices: [1, 2, 3, 4, 5]
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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']),
Expand Down
6 changes: 3 additions & 3 deletions plugins/modules/vmware_cluster_drs.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
type: bool
default: false
extends_documentation_fragment:
- community.vmware.vmware.documentation
- community.vmware.base_options
'''

EXAMPLES = r'''
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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']),
Expand Down
Loading

0 comments on commit 450df28

Please sign in to comment.