From 980b6a00e2f86aac634487ce087dafb49c8a61c5 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 22 Feb 2018 22:14:09 +0530 Subject: [PATCH] Fixup VMware module docs issues (#36409) (#36523) Fix various argspec vs documentation issue (cherry picked from commit 5d0ed38e3ad3c4b83bb0c083a8832f8a926da31c) Signed-off-by: Abhijeet Kasurde --- .../modules/cloud/vmware/_vsphere_guest.py | 11 +++---- lib/ansible/modules/cloud/vmware/vca_nat.py | 2 +- lib/ansible/modules/cloud/vmware/vca_vapp.py | 1 + .../modules/cloud/vmware/vcenter_folder.py | 1 + .../modules/cloud/vmware/vcenter_license.py | 19 +++-------- .../modules/cloud/vmware/vmware_dvs_host.py | 3 +- .../cloud/vmware/vmware_dvs_portgroup.py | 27 ++++++++++++++++ .../modules/cloud/vmware/vmware_guest.py | 1 + .../vmware/vmware_guest_file_operation.py | 10 +++--- .../cloud/vmware/vmware_guest_powerstate.py | 12 +++++-- .../cloud/vmware/vmware_guest_snapshot.py | 8 +++++ .../cloud/vmware/vmware_guest_tools_wait.py | 2 +- .../modules/cloud/vmware/vmware_host.py | 1 + .../cloud/vmware/vmware_host_acceptance.py | 1 + .../vmware/vmware_host_config_manager.py | 1 + .../cloud/vmware/vmware_host_datastore.py | 2 ++ .../vmware/vmware_host_firewall_manager.py | 1 + .../vmware/vmware_host_service_manager.py | 2 ++ .../cloud/vmware/vmware_local_role_manager.py | 3 ++ .../cloud/vmware/vmware_maintenancemode.py | 17 +++++----- .../modules/cloud/vmware/vmware_portgroup.py | 6 ++++ .../cloud/vmware/vmware_resource_pool.py | 32 +++++++------------ .../modules/cloud/vmware/vmware_vm_shell.py | 1 + .../cloud/vmware/vmware_vm_vm_drs_rule.py | 6 +++- .../modules/cloud/vmware/vmware_vmkernel.py | 7 +++- .../modules/cloud/vmware/vmware_vswitch.py | 1 + .../modules/cloud/vmware/vsphere_copy.py | 4 ++- .../cloud/webfaction/webfaction_app.py | 16 +++++----- .../modules/cloud/webfaction/webfaction_db.py | 2 +- .../cloud/webfaction/webfaction_site.py | 5 +-- lib/ansible/modules/net_tools/nmcli.py | 4 +-- .../utils/module_docs_fragments/vca.py | 2 +- .../utils/module_docs_fragments/vmware.py | 3 +- test/sanity/validate-modules/ignore.txt | 8 ----- 34 files changed, 136 insertions(+), 86 deletions(-) diff --git a/lib/ansible/modules/cloud/vmware/_vsphere_guest.py b/lib/ansible/modules/cloud/vmware/_vsphere_guest.py index 9e711ac2f06..8e4a2f34852 100644 --- a/lib/ansible/modules/cloud/vmware/_vsphere_guest.py +++ b/lib/ansible/modules/cloud/vmware/_vsphere_guest.py @@ -29,7 +29,6 @@ options: - The hostname of the vcenter server the module will connect to, to create the guest. required: true default: null - aliases: [] validate_certs: description: - Validate SSL certs. Note, if running on python without SSLContext @@ -39,7 +38,7 @@ options: never validate on python <= 2.7.8. required: false default: yes - choices: ['yes', 'no'] + type: bool version_added: 2.1 guest: description: @@ -83,7 +82,7 @@ options: - Specifies if the VM should be deployed from a template (mutually exclusive with 'state' parameter). No guest customization changes to hardware such as CPU, RAM, NICs or Disks can be applied when launching from template. default: no - choices: ['yes', 'no'] + type: bool template_src: version_added: "1.9" description: @@ -100,7 +99,7 @@ options: - Specifies if the VM should be powered on after the clone. required: false default: yes - choices: ['yes', 'no'] + type: bool vm_disk: description: - A key, value list of disks and their sizes and which datastore to keep it in. @@ -131,13 +130,13 @@ options: vmware_guest_facts: description: - Gather facts from vCenter on a particular VM - required: false + type: bool default: null force: description: - Boolean. Allows you to run commands which may alter the running state of a guest. Also used to reconfigure and destroy. default: "no" - choices: [ "yes", "no" ] + type: bool notes: - This module should run from a system that can access vSphere directly. diff --git a/lib/ansible/modules/cloud/vmware/vca_nat.py b/lib/ansible/modules/cloud/vmware/vca_nat.py index 3a64f34dc58..119d019fa45 100644 --- a/lib/ansible/modules/cloud/vmware/vca_nat.py +++ b/lib/ansible/modules/cloud/vmware/vca_nat.py @@ -24,7 +24,7 @@ options: purge_rules: description: - If set to true, it will delete all rules in the gateway that are not given as parameter to this module. - required: false + type: bool default: false nat_rules: description: diff --git a/lib/ansible/modules/cloud/vmware/vca_vapp.py b/lib/ansible/modules/cloud/vmware/vca_vapp.py index f56ad43b7d9..5972aeefcf3 100644 --- a/lib/ansible/modules/cloud/vmware/vca_vapp.py +++ b/lib/ansible/modules/cloud/vmware/vca_vapp.py @@ -120,6 +120,7 @@ options: - The name of the virtual data center (VDC) where the vm should be created or contains the vAPP. required: false default: None +extends_documentation_fragment: vca ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/vmware/vcenter_folder.py b/lib/ansible/modules/cloud/vmware/vcenter_folder.py index 3090b100f19..f702a16a4c7 100644 --- a/lib/ansible/modules/cloud/vmware/vcenter_folder.py +++ b/lib/ansible/modules/cloud/vmware/vcenter_folder.py @@ -56,6 +56,7 @@ options: - This option is ignored, if C(parent_folder) is set. default: vm required: False + choices: [ datastore, host, network, vm ] state: description: - State of folder. diff --git a/lib/ansible/modules/cloud/vmware/vcenter_license.py b/lib/ansible/modules/cloud/vmware/vcenter_license.py index 6b85a1336ac..e324b667d62 100644 --- a/lib/ansible/modules/cloud/vmware/vcenter_license.py +++ b/lib/ansible/modules/cloud/vmware/vcenter_license.py @@ -34,24 +34,13 @@ author: Dag Wieers (@dagwieers) requirements: - pyVmomi options: - hostname: - description: - - The hostname or IP address of the vSphere vCenter. - required: yes - username: - description: - - The username to log into the vSphere vCenter. - required: yes - aliases: [admin, user] - password: - description: - - The password to log into to the vSphere vCenter. - required: yes - aliases: [pass, pwd] labels: description: - The optional labels of the license key to manage in vSphere vCenter. - This is dictionary with key/value pair. + default: { + 'source': 'ansible' + } license: description: - The license key to manage in vSphere vCenter. @@ -67,6 +56,7 @@ notes: an evaluation license only. - The evaluation license (00000-00000-00000-00000-00000) is not listed when unused. +extends_documentation_fragment: vmware.documentation ''' EXAMPLES = r''' @@ -204,5 +194,6 @@ def main(): module.exit_json(**result) + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/vmware/vmware_dvs_host.py b/lib/ansible/modules/cloud/vmware/vmware_dvs_host.py index a756c477bb8..0a45b3607b7 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_dvs_host.py +++ b/lib/ansible/modules/cloud/vmware/vmware_dvs_host.py @@ -48,8 +48,9 @@ options: state: description: - If the host should be present or absent attached to the vSwitch. - choices: [present, absent] + choices: [ present, absent ] required: True + default: 'present' extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py b/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py index 1b130fb227d..3231c66037e 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py +++ b/lib/ansible/modules/cloud/vmware/vmware_dvs_portgroup.py @@ -62,6 +62,7 @@ options: description: - Determines if the portgroup should be present or not. required: True + type: bool choices: - 'present' - 'absent' @@ -71,6 +72,7 @@ options: - Indicates whether this is a VLAN trunk or not. required: False default: False + type: bool version_added: '2.5' network_policy: description: @@ -81,6 +83,11 @@ options: - '- C(mac_changes) (bool): indicates whether mac changes are allowed. (default: false)' required: False version_added: '2.5' + default: { + promiscuous: False, + forged_transmits: False, + mac_changes: False, + } teaming_policy: description: - Dictionary which configures the different teaming values for portgroup. @@ -92,6 +99,12 @@ options: - '- C(rolling_order) (bool): Indicate whether or not to use a rolling policy when restoring links. (default: False)' required: False version_added: '2.5' + default: { + 'notify_switches': True, + 'load_balance_policy': 'loadbalance_srcid', + 'inbound_policy': False, + 'rolling_order': False + } port_policy: description: - Dictionary which configures the advanced policy settings for the portgroup. @@ -109,6 +122,20 @@ options: - '- C(vlan_override) (bool): indicates if the vlan can be changed per port. (default: false)' required: False version_added: '2.5' + default: { + 'traffic_filter_override': False, + 'network_rp_override': False, + 'live_port_move': False, + 'security_override': False, + 'vendor_config_override': False, + 'port_config_reset_at_disconnect': True, + 'uplink_teaming_override': False, + 'block_override': True, + 'shaping_override': False, + 'vlan_override': False, + 'ipfix_override': False + } + extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest.py b/lib/ansible/modules/cloud/vmware/vmware_guest.py index 8e78fc5539a..ed3cb9f9099 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest.py @@ -61,6 +61,7 @@ options: - If this value is not set, VM is created without using a template. - If the VM exists already this setting will be ignored. - This parameter is case sensitive. + aliases: [ 'template_src' ] is_template: description: - Flag the instance as a template. diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py b/lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py index ae977d8a665..fa66e127c5d 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py @@ -76,7 +76,7 @@ options: required: True directory: description: - - Create or delete directory + - Create or delete directory. - 'Valid attributes are:' - ' path: directory path to create or remove' - ' operation: Valid values are create, delete' @@ -84,20 +84,22 @@ options: required: False copy: description: - - Copy file to vm networkless + - Copy file to vm without requiring network. - 'Valid attributes are:' - ' src: file source absolute or relative' - ' dest: file destination, path must be exist' - ' overwrite: False or True (not required, default False)' required: False - file: + fetch: description: - - Get file from vm networkless + - Get file from virtual machine without requiring network. - 'Valid attributes are:' - ' src: The file on the remote system to fetch. This I(must) be a file, not a directory' - ' dest: file destination on localhost, path must be exist' required: False + version_added: 2.5 +extends_documentation_fragment: vmware.documentation ''' EXAMPLES = ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py b/lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py index 78ab750a495..6f6f224c3f6 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py @@ -28,7 +28,8 @@ options: state: description: - Set the state of the virtual machine. - choices: [ powered-off, powered-on, reboot-guest, restarted, shutdown-guest, suspended ] + choices: [ powered-off, powered-on, reboot-guest, restarted, shutdown-guest, suspended, present] + default: present name: description: - Name of the virtual machine to work with. @@ -64,6 +65,13 @@ options: - Date and time in string format at which specificed task needs to be performed. - "The required format for date and time - 'dd/mm/yyyy hh:mm'." - Scheduling task requires vCenter server. A standalone ESXi server does not support this option. + force: + description: + - Ignore warnings and complete the actions. + - This parameter is useful while forcing virtual machine state. + default: False + type: bool + version_added: 2.5 extends_documentation_fragment: vmware.documentation ''' @@ -111,7 +119,7 @@ def main(): argument_spec = vmware_argument_spec() argument_spec.update( state=dict(type='str', default='present', - choices=['powered-off', 'powered-on', 'reboot-guest', 'restarted', 'shutdown-guest', 'suspended']), + choices=['present', 'powered-off', 'powered-on', 'reboot-guest', 'restarted', 'shutdown-guest', 'suspended']), name=dict(type='str'), name_match=dict(type='str', choices=['first', 'last'], default='first'), uuid=dict(type='str'), diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py b/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py index 126e028faf9..2be72a0042e 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest_snapshot.py @@ -34,6 +34,7 @@ options: - Manage snapshots attached to a specific virtual machine. required: True choices: ['present', 'absent', 'revert', 'remove_all'] + default: 'present' name: description: - Name of the VM to work with @@ -75,6 +76,7 @@ options: description: description: - Define an arbitrary description to attach to snapshot. + default: '' quiesce: description: - If set to C(true) and virtual machine is powered on, it will quiesce the @@ -86,6 +88,8 @@ options: this flag is set to C(false). required: False version_added: "2.4" + type: bool + default: False memory_dump: description: - If set to C(true), memory dump of virtual machine is also included in snapshot. @@ -94,12 +98,16 @@ options: this flag is set to C(false). required: False version_added: "2.4" + type: bool + default: False remove_children: description: - If set to C(true) and state is set to C(absent), then entire snapshot subtree is set for removal. required: False version_added: "2.4" + type: bool + default: False new_snapshot_name: description: - Value to rename the existing snapshot to diff --git a/lib/ansible/modules/cloud/vmware/vmware_guest_tools_wait.py b/lib/ansible/modules/cloud/vmware/vmware_guest_tools_wait.py index dda1336fac6..ddd40602d64 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_guest_tools_wait.py +++ b/lib/ansible/modules/cloud/vmware/vmware_guest_tools_wait.py @@ -156,8 +156,8 @@ def main(): argument_spec = vmware_argument_spec() argument_spec.update( name=dict(type='str'), - name_match=dict(type='str', default='first'), folder=dict(type='str', default='/vm'), + name_match=dict(type='str', default='first', choices=['first', 'last']), uuid=dict(type='str'), ) module = AnsibleModule( diff --git a/lib/ansible/modules/cloud/vmware/vmware_host.py b/lib/ansible/modules/cloud/vmware/vmware_host.py index 1e963d70bc1..1b48a15edc9 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host.py @@ -77,6 +77,7 @@ options: - "Use following command to get hostsystem's certificate's thumbprint - " - "# openssl x509 -in /etc/vmware/ssl/rui.crt -fingerprint -sha1 -noout" version_added: 2.5 + default: '' extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_acceptance.py b/lib/ansible/modules/cloud/vmware/vmware_host_acceptance.py index 608ccac2223..049bfdfdc93 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_acceptance.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_acceptance.py @@ -45,6 +45,7 @@ options: - If set to C(present), then will set given acceptance level. choices: [ list, present ] required: False + default: 'list' acceptance_level: description: - Name of acceptance level. diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_config_manager.py b/lib/ansible/modules/cloud/vmware/vmware_host_config_manager.py index 837a2a96b12..cfbb8b4cff9 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_config_manager.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_config_manager.py @@ -42,6 +42,7 @@ options: description: - A dictionary of advance configuration parameter. - Invalid configuration parameters are ignored. + default: {} extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_datastore.py b/lib/ansible/modules/cloud/vmware/vmware_host_datastore.py index 5fa94ba3edb..614ea58d681 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_datastore.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_datastore.py @@ -41,6 +41,7 @@ options: description: - Type of the datastore to configure (nfs/vmfs). required: true + choices: [ 'nfs', 'vmfs' ] nfs_server: description: - NFS host serving nfs datastore. @@ -54,6 +55,7 @@ options: - ReadOnly or ReadWrite mount. - Unused if datastore type is not set to C(nfs) and state is not set to C(present). default: False + type: bool vmfs_device_name: description: - Name of the device to be used as VMFS datastore. diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_firewall_manager.py b/lib/ansible/modules/cloud/vmware/vmware_host_firewall_manager.py index 1454aa483e5..7e007501579 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_firewall_manager.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_firewall_manager.py @@ -44,6 +44,7 @@ options: - Each member of list is rule set name and state to be set the rule. - Both rule name and rule state are required parameters. - Please see examples for more information. + default: [] extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_host_service_manager.py b/lib/ansible/modules/cloud/vmware/vmware_host_service_manager.py index 2b703166b36..287927bb0c0 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_host_service_manager.py +++ b/lib/ansible/modules/cloud/vmware/vmware_host_service_manager.py @@ -46,12 +46,14 @@ options: - "State value 'start' and 'present' has same effect." - "State value 'stop' and 'absent' has same effect." choices: [ absent, present, restart, start, stop ] + default: 'start' service_policy: description: - Set of valid service policy strings. - If set C(on), then service should be started when the host starts up. - If set C(automatic), then service should run if and only if it has open firewall ports. - If set C(off), then Service should not be started when the host starts up. + choices: [ 'automatic', 'off', 'on' ] service_name: description: - Name of Service to be managed. This is brief identifier for the service, for example, ntpd, vxsyslogd etc. diff --git a/lib/ansible/modules/cloud/vmware/vmware_local_role_manager.py b/lib/ansible/modules/cloud/vmware/vmware_local_role_manager.py index 0cd0a24eaa9..c437fa786d2 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_local_role_manager.py +++ b/lib/ansible/modules/cloud/vmware/vmware_local_role_manager.py @@ -37,6 +37,7 @@ options: description: - The list of privileges that role needs to have. - Please see U(https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.security.doc/GUID-ED56F3C4-77D0-49E3-88B6-B99B8B437B62.html) + default: [] state: description: - Indicate desired state of the role. @@ -47,6 +48,7 @@ options: description: - If set to C(False) then prevents the role from being removed if any permissions are using it. default: False + type: bool extends_documentation_fragment: vmware.documentation ''' @@ -273,5 +275,6 @@ def main(): vmware_local_role_manager = VMwareLocalRoleManager(module) vmware_local_role_manager.process_state() + if __name__ == '__main__': main() diff --git a/lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py b/lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py index a200642c24e..e9c2bacfe7d 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py +++ b/lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py @@ -36,7 +36,7 @@ options: description: - Name of the host as defined in vCenter. required: True - vsan_mode: + vsan: description: - Specify which VSAN compliant mode to enter. choices: @@ -44,14 +44,13 @@ options: - 'evacuateAllData' - 'noAction' required: False + aliases: [ 'vsan_mode' ] evacuate: description: - - If True, evacuate all powered off VMs. - choices: - - True - - False + - If set to C(True), evacuate all powered off VMs. default: False required: False + type: bool timeout: description: - Specify a timeout for the operation. @@ -173,9 +172,11 @@ class VmwareMaintenanceMgr(PyVmomi): def main(): spec = vmware_argument_spec() spec.update(dict(esxi_hostname=dict(type='str', required=True), - vsan=dict(type='str', choices=['ensureObjectAccessibility', - 'evacuateAllData', - 'noAction'] + vsan=dict(type='str', + choices=['ensureObjectAccessibility', + 'evacuateAllData', + 'noAction'], + aliases=['vsan_mode'], ), evacuate=dict(type='bool', default=False), timeout=dict(default=0, type='int'), diff --git a/lib/ansible/modules/cloud/vmware/vmware_portgroup.py b/lib/ansible/modules/cloud/vmware/vmware_portgroup.py index 32c17ed7aa2..df51f83f52f 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_portgroup.py +++ b/lib/ansible/modules/cloud/vmware/vmware_portgroup.py @@ -58,6 +58,11 @@ options: - '- C(mac_changes) (bool): indicates whether mac changes are allowed. (default: false)' required: False version_added: "2.2" + default: { + mac_changes: false, + promiscuous_mode: false, + forged_transmits: false, + } cluster_name: description: - Name of cluster name for host membership. @@ -77,6 +82,7 @@ options: - 'present' - 'absent' version_added: '2.5' + default: present extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py b/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py index 13c5508fd3f..1cb2f3a3398 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py +++ b/lib/ansible/modules/cloud/vmware/vmware_resource_pool.py @@ -38,22 +38,11 @@ options: description: - Resource pool name to manage. required: True - hostname: - description: - - ESXi hostname to manage. - required: True - username: - description: - - ESXi username. - required: True - password: - description: - - ESXi password. - required: True cpu_expandable_reservations: description: - In a resource pool with an expandable reservation, the reservation on a resource pool can grow beyond the specified value. default: True + type: bool cpu_reservation: description: - Amount of resource that is guaranteed available to the virtual machine or resource pool. @@ -61,7 +50,8 @@ options: cpu_limit: description: - The utilization of a virtual machine/resource pool will not exceed this limit, even if there are available resources. - default: -1 (No limit) + - The default value -1 indicates no limit. + default: -1 cpu_shares: description: - Memory shares are used in case of resource contention. @@ -70,11 +60,12 @@ options: - custom - low - normal - default: Normal + default: normal mem_expandable_reservations: description: - In a resource pool with an expandable reservation, the reservation on a resource pool can grow beyond the specified value. default: True + type: bool mem_reservation: description: - Amount of resource that is guaranteed available to the virtual machine or resource pool. @@ -82,7 +73,8 @@ options: mem_limit: description: - The utilization of a virtual machine/resource pool will not exceed this limit, even if there are available resources. - default: -1 (No limit) + - The default value -1 indicates no limit. + default: -1 mem_shares: description: - Memory shares are used in case of resource contention. @@ -91,7 +83,7 @@ options: - custom - low - normal - default: Normal + default: normal state: description: - Add or remove the resource pool @@ -294,14 +286,14 @@ def main(): resource_pool=dict(required=True, type='str'), mem_shares=dict(type='str', default="normal", choices=[ 'high', 'custom', 'normal', 'low']), - mem_limit=dict(type='int', default="-1"), - mem_reservation=dict(type='int', default="0"), + mem_limit=dict(type='int', default=-1), + mem_reservation=dict(type='int', default=0), mem_expandable_reservations=dict( type='bool', default="True"), cpu_shares=dict(type='str', default="normal", choices=[ 'high', 'custom', 'normal', 'low']), - cpu_limit=dict(type='int', default="-1"), - cpu_reservation=dict(type='int', default="0"), + cpu_limit=dict(type='int', default=-1), + cpu_reservation=dict(type='int', default=0), cpu_expandable_reservations=dict( type='bool', default="True"), state=dict(default='present', choices=['present', 'absent'], type='str'))) diff --git a/lib/ansible/modules/cloud/vmware/vmware_vm_shell.py b/lib/ansible/modules/cloud/vmware/vmware_vm_shell.py index 3edbd734fe2..91d80454aec 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vm_shell.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vm_shell.py @@ -85,6 +85,7 @@ options: vm_shell_args: description: - The argument to the program. + default: " " vm_shell_env: description: - Comma separated list of environment variable, specified in the guest OS notation. diff --git a/lib/ansible/modules/cloud/vmware/vmware_vm_vm_drs_rule.py b/lib/ansible/modules/cloud/vmware/vmware_vm_vm_drs_rule.py index bb8123cc6dd..a57ea010727 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vm_vm_drs_rule.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vm_vm_drs_rule.py @@ -46,17 +46,20 @@ options: - If set to C(True), the DRS rule will be enabled. - Effective only if C(state) is set to C(present). default: False + type: bool mandatory: description: - If set to C(True), the DRS rule will be mandatory. - Effective only if C(state) is set to C(present). default: False + type: bool affinity_rule: description: - If set to C(True), the DRS rule will be an Affinity rule. - If set to C(False), the DRS rule will be an Anti-Affinity rule. - Effective only if C(state) is set to C(present). - default: False + default: True + type: bool state: description: - If set to C(present), then the DRS rule is created if not present. @@ -64,6 +67,7 @@ options: - If set to C(absent), then the DRS rule is deleted if present. required: False default: present + choices: [ present, absent ] extends_documentation_fragment: vmware.documentation ''' diff --git a/lib/ansible/modules/cloud/vmware/vmware_vmkernel.py b/lib/ansible/modules/cloud/vmware/vmware_vmkernel.py index c9d583c042d..b1adbe7ca1c 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vmkernel.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vmkernel.py @@ -63,12 +63,13 @@ options: - The Subnet Mask for the VMKernel interface. - Use C(network) parameter with C(subnet_mask) instead. - Deprecated option, will be removed in version 2.9. - vland_id: + vlan_id: description: - The VLAN ID for the VMKernel interface. - Required parameter only if C(state) is set to C(present). - Optional parameter from version 2.5 and onwards. required: False + version_added: 2.0 mtu: description: - The MTU for the VMKernel interface. @@ -79,18 +80,22 @@ options: description: - Enable the VMKernel interface for VSAN traffic. required: False + type: bool enable_vmotion: description: - Enable the VMKernel interface for vMotion traffic. required: False + type: bool enable_mgmt: description: - Enable the VMKernel interface for Management traffic. required: False + type: bool enable_ft: description: - Enable the VMKernel interface for Fault Tolerance traffic. required: False + type: bool state: description: - If set to C(present), VMKernel is created with the given specifications. diff --git a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py index eeeea19a5d8..2fdf5f8bdf3 100644 --- a/lib/ansible/modules/cloud/vmware/vmware_vswitch.py +++ b/lib/ansible/modules/cloud/vmware/vmware_vswitch.py @@ -47,6 +47,7 @@ options: mtu: description: - MTU to configure on vSwitch. + default: 1500 state: description: - Add or remove the switch. diff --git a/lib/ansible/modules/cloud/vmware/vsphere_copy.py b/lib/ansible/modules/cloud/vmware/vsphere_copy.py index 0005c3b67ff..86e1a0252d0 100644 --- a/lib/ansible/modules/cloud/vmware/vsphere_copy.py +++ b/lib/ansible/modules/cloud/vmware/vsphere_copy.py @@ -26,10 +26,12 @@ options: description: - The vCenter server on which the datastore is available. required: true + aliases: ['hostname'] login: description: - The login name to authenticate on the vCenter server. required: true + aliases: ['username'] password: description: - The password to authenticate on the vCenter server. @@ -55,7 +57,7 @@ options: - If C(no), SSL certificates will not be validated. This should only be set to C(no) when no other option exists. default: 'yes' - choices: ['yes', 'no'] + type: bool notes: - "This module ought to be run from a system that can access vCenter directly and has the file to transfer. diff --git a/lib/ansible/modules/cloud/webfaction/webfaction_app.py b/lib/ansible/modules/cloud/webfaction/webfaction_app.py index d2f6a3a6e7e..ebe7bfad78d 100644 --- a/lib/ansible/modules/cloud/webfaction/webfaction_app.py +++ b/lib/ansible/modules/cloud/webfaction/webfaction_app.py @@ -56,7 +56,7 @@ options: autostart: description: - Whether the app should restart with an autostart.cgi script - required: false + type: bool default: "no" extra_info: @@ -68,7 +68,7 @@ options: port_open: description: - IF the port should be opened - required: false + type: bool default: false login_name: @@ -91,12 +91,12 @@ options: EXAMPLES = ''' - name: Create a test app webfaction_app: - name="my_wsgi_app1" - state=present - type=mod_wsgi35-python27 - login_name={{webfaction_user}} - login_password={{webfaction_passwd}} - machine={{webfaction_machine}} + name: "my_wsgi_app1" + state: present + type: mod_wsgi35-python27 + login_name: "{{webfaction_user}}" + login_password: "{{webfaction_passwd}}" + machine: "{{webfaction_machine}}" ''' import xmlrpclib diff --git a/lib/ansible/modules/cloud/webfaction/webfaction_db.py b/lib/ansible/modules/cloud/webfaction/webfaction_db.py index deb8fd4e877..28d16a3f8ea 100644 --- a/lib/ansible/modules/cloud/webfaction/webfaction_db.py +++ b/lib/ansible/modules/cloud/webfaction/webfaction_db.py @@ -106,7 +106,7 @@ def main(): name=dict(required=True), state=dict(required=False, choices=['present', 'absent'], default='present'), # You can specify an IP address or hostname. - type=dict(required=True), + type=dict(required=True, choices=['mysql', 'postgresql']), password=dict(required=False, default=None, no_log=True), login_name=dict(required=True), login_password=dict(required=True, no_log=True), diff --git a/lib/ansible/modules/cloud/webfaction/webfaction_site.py b/lib/ansible/modules/cloud/webfaction/webfaction_site.py index bee932419f5..4230b659ade 100644 --- a/lib/ansible/modules/cloud/webfaction/webfaction_site.py +++ b/lib/ansible/modules/cloud/webfaction/webfaction_site.py @@ -53,10 +53,7 @@ options: https: description: - Whether or not to use HTTPS - required: false - choices: - - true - - false + type: bool default: 'false' site_apps: diff --git a/lib/ansible/modules/net_tools/nmcli.py b/lib/ansible/modules/net_tools/nmcli.py index 6d297856b55..18e334dea3b 100644 --- a/lib/ansible/modules/net_tools/nmcli.py +++ b/lib/ansible/modules/net_tools/nmcli.py @@ -35,7 +35,7 @@ options: autoconnect: required: False default: "yes" - choices: [ "yes", "no" ] + type: bool description: - Whether the connection should start on boot. - Whether the connection profile can be automatically activated @@ -151,7 +151,7 @@ options: description: - This is only used with bond - ARP IP target stp: - required: False + type: bool default: None description: - This is only used with bridge and controls whether Spanning Tree Protocol (STP) is enabled for this bridge diff --git a/lib/ansible/utils/module_docs_fragments/vca.py b/lib/ansible/utils/module_docs_fragments/vca.py index a7a673f3b71..3500822d246 100644 --- a/lib/ansible/utils/module_docs_fragments/vca.py +++ b/lib/ansible/utils/module_docs_fragments/vca.py @@ -67,7 +67,7 @@ options: verify_certs: description: - If the certificates of the authentication is to be verified. - required: false + type: bool default: True vdc_name: description: diff --git a/lib/ansible/utils/module_docs_fragments/vmware.py b/lib/ansible/utils/module_docs_fragments/vmware.py index e523060d66c..2752285db88 100644 --- a/lib/ansible/utils/module_docs_fragments/vmware.py +++ b/lib/ansible/utils/module_docs_fragments/vmware.py @@ -38,9 +38,8 @@ options: description: - Allows connection when SSL certificates are not valid. Set to false when certificates are not trusted. - required: False default: 'True' - choices: ['True', 'False'] + type: bool port: description: - The port number of the vSphere vCenter or ESXi server. diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 063cdff54d2..07c85d0ae0d 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -161,15 +161,7 @@ lib/ansible/modules/cloud/univention/udm_share.py E323 lib/ansible/modules/cloud/vmware/vca_fw.py E322 lib/ansible/modules/cloud/vmware/vca_nat.py E322 lib/ansible/modules/cloud/vmware/vca_vapp.py E322 -lib/ansible/modules/cloud/vmware/vcenter_license.py E322 lib/ansible/modules/cloud/vmware/vmware_guest.py E322 -lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py E322 -lib/ansible/modules/cloud/vmware/vmware_guest_file_operation.py E323 -lib/ansible/modules/cloud/vmware/vmware_guest_powerstate.py E322 -lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py E322 -lib/ansible/modules/cloud/vmware/vmware_maintenancemode.py E323 -lib/ansible/modules/cloud/vmware/vmware_vmkernel.py E322 -lib/ansible/modules/cloud/vmware/vmware_vmkernel.py E323 lib/ansible/modules/cloud/vmware/vsphere_copy.py E322 lib/ansible/modules/cloud/vultr/vr_dns_domain.py E323 lib/ansible/modules/cloud/vultr/vr_firewall_rule.py E323