diff --git a/lib/ansible/module_utils/influxdb.py b/lib/ansible/module_utils/influxdb.py index 0cf71972f60..3278b6469fa 100644 --- a/lib/ansible/module_utils/influxdb.py +++ b/lib/ansible/module_utils/influxdb.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- + # Copyright: (c) 2017, Ansible Project # Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause) @@ -49,17 +50,17 @@ class InfluxDb(): @staticmethod def influxdb_argument_spec(): return dict( - hostname=dict(default='localhost', type='str'), - port=dict(default=8086, type='int'), - username=dict(default='root', type='str', aliases=['login_username']), - password=dict(default='root', type='str', no_log=True, aliases=['login_password']), - ssl=dict(default=False, type='bool'), - validate_certs=dict(default=True, type='bool'), + hostname=dict(type='str', default='localhost'), + port=dict(type='int', default=8086), + username=dict(type='str', default='root', aliases=['login_username']), + password=dict(type='str', default='root', no_log=True, aliases=['login_password']), + ssl=dict(type='bool', default=False), + validate_certs=dict(type='bool', default=True), timeout=dict(type='int'), - retries=dict(default=3, type='int'), - proxies=dict(default={}, type='dict'), - use_udp=dict(default=False, type='bool'), - udp_port=dict(type=int) + retries=dict(type='int', default=3), + proxies=dict(type='dict', default={}), + use_udp=dict(type='bool', default=False), + udp_port=dict(type='int'), ) def connect_to_influxdb(self): diff --git a/lib/ansible/module_utils/network/nso/nso.py b/lib/ansible/module_utils/network/nso/nso.py index 6a01d6100fb..e6c400a430d 100644 --- a/lib/ansible/module_utils/network/nso/nso.py +++ b/lib/ansible/module_utils/network/nso/nso.py @@ -1,23 +1,7 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2017 Cisco and/or its affiliates. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# - +# Copyright: (c) 2017, Cisco and/or its affiliates. +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from ansible.module_utils.basic import env_fallback from ansible.module_utils.urls import open_url @@ -35,10 +19,10 @@ except NameError: nso_argument_spec = dict( - url=dict(required=True), - username=dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME']), required=True), - password=dict(fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), required=True, no_log=True), - timeout=dict(default=300, type=int) + url=dict(type='str', required=True), + username=dict(type='str', required=True, fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])), + password=dict(type='str', required=True, no_log=True, fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD'])), + timeout=dict(type='int', default=300), ) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py index 3dc3df4b75a..eb3d3ae26ff 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py @@ -12,13 +12,13 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: azure_rm_managed_disk_facts version_added: "2.4" -short_description: Get managed disk facts. +short_description: Get managed disk facts description: - Get facts for a specific managed disk or all managed disks. @@ -26,38 +26,42 @@ description: options: name: description: - - Limit results to a specific managed disk + - Limit results to a specific managed disk. + type: str resource_group: description: - - Limit results to a specific resource group + - Limit results to a specific resource group. + type: str tags: description: - - Limit results by providing a list of tags. Format tags as 'key' or 'key:value'. + - Limit results by providing a list of tags. + - Format tags as 'key' or 'key:value'. + type: list extends_documentation_fragment: - azure - azure_tags author: - - "Bruno Medina (@brusMX)" + - Bruno Medina (@brusMX) ''' -EXAMPLES = ''' - - name: Get facts for one managed disk - azure_rm_managed_disk_facts: - name: Testing - resource_group: TestRG +EXAMPLES = r''' +- name: Get facts for one managed disk + azure_rm_managed_disk_facts: + name: Testing + resource_group: TestRG - - name: Get facts for all managed disks - azure_rm_managed_disk_facts: +- name: Get facts for all managed disks + azure_rm_managed_disk_facts: - - name: Get facts by tags - azure_rm_managed_disk_facts: - tags: - - testing +- name: Get facts by tags + azure_rm_managed_disk_facts: + tags: + - testing ''' -RETURN = ''' +RETURN = r''' azure_managed_disk: description: List of managed disk dicts. returned: always @@ -66,39 +70,46 @@ azure_managed_disk: id: description: - Resource id. + type: str name: description: - Name of the managed disk. + type: str location: description: - Valid Azure location. + type: str storage_account_type: description: - Type of storage for the managed disk - sample: Standard_LRS type: str + sample: Standard_LRS create_option: description: - Create option of the disk - sample: copy type: str + sample: copy source_uri: description: - URI to a valid VHD file to be used or the resource ID of the managed disk to copy. + type: str os_type: description: - "Type of Operating System: C(linux) or C(windows)." + type: str disk_size_gb: description: - Size in GB of the managed disk to be created. + type: str managed_by: description: - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group. + type: str tags: description: - Tags to assign to the managed disk. - sample: { "tag": "value" } type: dict + sample: { "tag": "value" } ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase @@ -204,7 +215,7 @@ class AzureRMManagedDiskFacts(AzureRMModuleBase): try: response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group) except CloudError as exc: - self.fail('Failed to list items by resource group - {}'.format(str(exc))) + self.fail('Failed to list items by resource group - {0}'.format(str(exc))) results = [] for item in response: diff --git a/lib/ansible/modules/crypto/openssl_certificate.py b/lib/ansible/modules/crypto/openssl_certificate.py index e890f3f8a13..b5a8bb717f5 100644 --- a/lib/ansible/modules/crypto/openssl_certificate.py +++ b/lib/ansible/modules/crypto/openssl_certificate.py @@ -8,12 +8,10 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type - ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} - DOCUMENTATION = r''' --- module: openssl_certificate @@ -201,13 +199,13 @@ options: description: - A list of algorithms that you would accept the certificate to be signed with (e.g. ['sha256WithRSAEncryption', 'sha512WithRSAEncryption']). - type: str + type: list issuer: description: - The key/value pairs that must be present in the issuer name field of the certificate. - If you need to specify more than one value with the same key, use a list as value. - type: str + type: dict issuer_strict: description: @@ -220,7 +218,7 @@ options: description: - The key/value pairs that must be present in the subject name field of the certificate. - If you need to specify more than one value with the same key, use a list as value. - type: str + type: dict subject_strict: description: @@ -1092,7 +1090,7 @@ def main(): # provider: ownca ownca_path=dict(type='path'), ownca_privatekey_path=dict(type='path'), - ownca_privatekey_passphrase=dict(type='path', no_log=True), + ownca_privatekey_passphrase=dict(type='str', no_log=True), ownca_digest=dict(type='str', default='sha256'), ownca_version=dict(type='int', default=3), ownca_not_before=dict(type='str', default='+0s'), diff --git a/lib/ansible/modules/crypto/openssl_csr.py b/lib/ansible/modules/crypto/openssl_csr.py index b58a6d7d799..cd1a8b7bf44 100644 --- a/lib/ansible/modules/crypto/openssl_csr.py +++ b/lib/ansible/modules/crypto/openssl_csr.py @@ -67,7 +67,7 @@ options: description: - Key/value pairs that will be present in the subject name field of the certificate signing request. - If you need to specify more than one value with the same key, use a list as value. - type: str + type: dict version_added: '2.5' country_name: description: diff --git a/lib/ansible/modules/database/mysql/mysql_db.py b/lib/ansible/modules/database/mysql/mysql_db.py index 206bf6f93a0..1ba2d6739c3 100644 --- a/lib/ansible/modules/database/mysql/mysql_db.py +++ b/lib/ansible/modules/database/mysql/mysql_db.py @@ -1,20 +1,18 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# (c) 2012, Mark Theunissen +# Copyright: (c) 2012, Mark Theunissen # Sponsored by Four Kitchens http://fourkitchens.com. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type - ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: mysql_db short_description: Add or remove MySQL databases from a remote host. @@ -72,7 +70,7 @@ notes: extends_documentation_fragment: mysql ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a new database with name 'bobdata' mysql_db: name: bobdata @@ -250,26 +248,26 @@ def db_create(cursor, db, encoding, collation): def main(): module = AnsibleModule( argument_spec=dict( - login_user=dict(default=None), - login_password=dict(default=None, no_log=True), - login_host=dict(default="localhost"), - login_port=dict(default=3306, type='int'), - login_unix_socket=dict(default=None), - name=dict(required=True, aliases=['db']), - encoding=dict(default=""), - collation=dict(default=""), - target=dict(default=None, type='path'), - state=dict(default="present", choices=["absent", "present", "dump", "import"]), - ssl_cert=dict(default=None, type='path'), - ssl_key=dict(default=None, type='path'), - ssl_ca=dict(default=None, type='path'), - connect_timeout=dict(default=30, type='int'), - config_file=dict(default="~/.my.cnf", type='path'), - single_transaction=dict(default=False, type='bool'), - quick=dict(default=True, type='bool'), - ignore_tables=dict(default=[], type='list') + login_user=dict(type='str'), + login_password=dict(type='str', no_log=True), + login_host=dict(type='str', default='localhost'), + login_port=dict(type='int', default=3306), + login_unix_socket=dict(type='str'), + name=dict(type='str', required=True, aliases=['db']), + encoding=dict(type='str', default=''), + collation=dict(type='str', default=''), + target=dict(type='path'), + state=dict(type='str', default='present', choices=['absent', 'dump', 'import', 'present']), + ssl_cert=dict(type='path'), + ssl_key=dict(type='path'), + ssl_ca=dict(type='path'), + connect_timeout=dict(type='int', default=30), + config_file=dict(type='path', default='~/.my.cnf'), + single_transaction=dict(type='bool', default=False), + quick=dict(type='bool', default=True), + ignore_tables=dict(type='list', default=[]), ), - supports_check_mode=True + supports_check_mode=True, ) if mysql_driver is None: diff --git a/lib/ansible/modules/database/mysql/mysql_replication.py b/lib/ansible/modules/database/mysql/mysql_replication.py index ab3e16efb6d..b29838b2ba8 100644 --- a/lib/ansible/modules/database/mysql/mysql_replication.py +++ b/lib/ansible/modules/database/mysql/mysql_replication.py @@ -1,9 +1,8 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# (c) 2013, Balazs Pocze +# Copyright: (c) 2013, Balazs Pocze # Certain parts are taken from Mark Theunissen's mysqldb module -# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function @@ -15,20 +14,21 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: mysql_replication - short_description: Manage MySQL replication description: - Manages MySQL server replication, slave, master status get and change master host. version_added: "1.3" -author: "Balazs Pocze (@banyek)" +author: +- Balazs Pocze (@banyek) options: mode: description: - module operating mode. Could be getslave (SHOW SLAVE STATUS), getmaster (SHOW MASTER STATUS), changemaster (CHANGE MASTER TO), startslave (START SLAVE), stopslave (STOP SLAVE), resetslave (RESET SLAVE), resetslaveall (RESET SLAVE ALL) + type: str choices: - getslave - getmaster @@ -40,59 +40,74 @@ options: default: getslave master_host: description: - - same as mysql variable + - Same as mysql variable. + type: str master_user: description: - - same as mysql variable + - Same as mysql variable. + type: str master_password: description: - - same as mysql variable + - Same as mysql variable. + type: str master_port: description: - - same as mysql variable + - Same as mysql variable. + type: int master_connect_retry: description: - - same as mysql variable + - Same as mysql variable. + type: int master_log_file: description: - - same as mysql variable + - Same as mysql variable. + type: str master_log_pos: description: - - same as mysql variable + - Same as mysql variable. + type: int relay_log_file: description: - - same as mysql variable + - Same as mysql variable. + type: str relay_log_pos: description: - - same as mysql variable + - Same as mysql variable. + type: int master_ssl: description: - - same as mysql variable - choices: [ 0, 1 ] + - Same as mysql variable. + type: bool master_ssl_ca: description: - - same as mysql variable + - Same as mysql variable. + type: str master_ssl_capath: description: - - same as mysql variable + - Same as mysql variable. + type: str master_ssl_cert: description: - - same as mysql variable + - Same as mysql variable. + type: str master_ssl_key: description: - - same as mysql variable + - Same as mysql variable. + type: str master_ssl_cipher: description: - - same as mysql variable + - Same as mysql variable. + type: str master_auto_position: description: - - does the host uses GTID based replication or not + - Whether the host uses GTID based replication or not. + type: bool version_added: "2.0" - -extends_documentation_fragment: mysql +extends_documentation_fragment: +- mysql ''' -EXAMPLES = ''' +EXAMPLES = r''' # Stop mysql slave thread - mysql_replication: mode: stopslave @@ -180,33 +195,33 @@ def changemaster(cursor, chm, chm_params): def main(): module = AnsibleModule( argument_spec=dict( - login_user=dict(default=None), - login_password=dict(default=None, no_log=True), - login_host=dict(default="localhost"), - login_port=dict(default=3306, type='int'), - login_unix_socket=dict(default=None), - mode=dict(default="getslave", choices=["getmaster", "getslave", "changemaster", "stopslave", "startslave", "resetslave", "resetslaveall"]), - master_auto_position=dict(default=False, type='bool'), - master_host=dict(default=None), - master_user=dict(default=None), - master_password=dict(default=None, no_log=True), - master_port=dict(default=None, type='int'), - master_connect_retry=dict(default=None, type='int'), - master_log_file=dict(default=None), - master_log_pos=dict(default=None, type='int'), - relay_log_file=dict(default=None), - relay_log_pos=dict(default=None, type='int'), - master_ssl=dict(default=False, type='bool'), - master_ssl_ca=dict(default=None), - master_ssl_capath=dict(default=None), - master_ssl_cert=dict(default=None), - master_ssl_key=dict(default=None), - master_ssl_cipher=dict(default=None), - connect_timeout=dict(default=30, type='int'), - config_file=dict(default="~/.my.cnf", type='path'), - ssl_cert=dict(default=None), - ssl_key=dict(default=None), - ssl_ca=dict(default=None), + login_user=dict(type='str'), + login_password=dict(type='str', no_log=True), + login_host=dict(type='str', default='localhost'), + login_port=dict(type='int', default=3306), + login_unix_socket=dict(type='str'), + mode=dict(type='str', default='getslave', choices=['getmaster', 'getslave', 'changemaster', 'stopslave', 'startslave', 'resetslave', 'resetslaveall']), + master_auto_position=dict(type='bool', default=False), + master_host=dict(type='str'), + master_user=dict(type='str'), + master_password=dict(type='str', no_log=True), + master_port=dict(type='int'), + master_connect_retry=dict(type='int'), + master_log_file=dict(type='str'), + master_log_pos=dict(type='int'), + relay_log_file=dict(type='str'), + relay_log_pos=dict(type='int'), + master_ssl=dict(type='bool', default=False), + master_ssl_ca=dict(type='str'), + master_ssl_capath=dict(type='str'), + master_ssl_cert=dict(type='str'), + master_ssl_key=dict(type='str'), + master_ssl_cipher=dict(type='str'), + connect_timeout=dict(type='int', default=30), + config_file=dict(type='path', default='~/.my.cnf'), + ssl_cert=dict(type='path'), + ssl_key=dict(type='path'), + ssl_ca=dict(type='path'), ) ) mode = module.params["mode"] diff --git a/lib/ansible/modules/database/mysql/mysql_user.py b/lib/ansible/modules/database/mysql/mysql_user.py index 349157ee5bd..9b29471928c 100644 --- a/lib/ansible/modules/database/mysql/mysql_user.py +++ b/lib/ansible/modules/database/mysql/mysql_user.py @@ -1,6 +1,7 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- -# (c) 2012, Mark Theunissen +# Copyright: (c) 2012, Mark Theunissen # Sponsored by Four Kitchens http://fourkitchens.com. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) @@ -13,38 +14,40 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: mysql_user -short_description: Adds or removes a user from a MySQL database. +short_description: Adds or removes a user from a MySQL database description: - Adds or removes a user from a MySQL database. version_added: "0.6" options: name: description: - - name of the user (role) to add or remove + - Name of the user (role) to add or remove. + type: str required: true password: description: - - set the user's password. + - Set the user's password.. + type: str encrypted: description: - - Indicate that the 'password' field is a `mysql_native_password` hash + - Indicate that the 'password' field is a `mysql_native_password` hash. type: bool - default: 'no' + default: no version_added: "2.0" host: description: - - the 'host' part of the MySQL username + - The 'host' part of the MySQL username. + type: str default: localhost host_all: description: - - override the host option, making ansible apply changes to - all hostnames for a given user. This option cannot be used - when creating users + - Override the host option, making ansible apply changes to all hostnames for a given user. + - This option cannot be used when creating users. type: bool - default: 'no' + default: no version_added: "2.1" priv: description: @@ -57,37 +60,41 @@ options: exactly as returned by a C(SHOW GRANT) statement. If not followed, the module will always report changes. It includes grouping columns by permission (C(SELECT(col1,col2)) instead of C(SELECT(col1),SELECT(col2))). + type: str append_privs: description: - Append the privileges defined by priv to the existing ones for this user instead of overwriting existing ones. type: bool - default: 'no' + default: no version_added: "1.4" sql_log_bin: description: - Whether binary logging should be enabled or disabled for the connection. type: bool - default: 'yes' + default: yes version_added: "2.1" state: description: - - Whether the user should exist. When C(absent), removes - the user. + - Whether the user should exist. + - When C(absent), removes the user. + type: str + choices: [ absent, present ] default: present - choices: [ "present", "absent" ] check_implicit_admin: description: - Check if mysql allows login as root/nopassword before trying supplied credentials. type: bool - default: 'no' + default: no version_added: "1.3" update_password: - default: always - choices: ['always', 'on_create'] - version_added: "2.0" description: - - C(always) will update passwords if they differ. C(on_create) will only set the password for newly created users. + - C(always) will update passwords if they differ. + - C(on_create) will only set the password for newly created users. + type: str + choices: [ always, on_create ] + default: always + version_added: "2.0" notes: - "MySQL server installs with default login_user of 'root' and no password. To secure this user as part of an idempotent playbook, you must create at least two tasks: the first must change the root user's password, @@ -96,74 +103,76 @@ notes: the file." - Currently, there is only support for the `mysql_native_password` encrypted password hash module. -author: "Jonathan Mainguy (@Jmainguy)" +author: +- Jonathan Mainguy (@Jmainguy) extends_documentation_fragment: mysql ''' -EXAMPLES = """ -# Removes anonymous user account for localhost -- mysql_user: +EXAMPLES = r''' +- name: Removes anonymous user account for localhost + mysql_user: name: '' host: localhost state: absent -# Removes all anonymous user accounts -- mysql_user: +- name: Removes all anonymous user accounts + mysql_user: name: '' host_all: yes state: absent -# Create database user with name 'bob' and password '12345' with all database privileges -- mysql_user: +- name: Create database user with name 'bob' and password '12345' with all database privileges + mysql_user: name: bob password: 12345 priv: '*.*:ALL' state: present -# Create database user with name 'bob' and previously hashed mysql native password '*EE0D72C1085C46C5278932678FBE2C6A782821B4' with all database privileges -- mysql_user: +- name: Create database user using hashed password with all database privileges + mysql_user: name: bob password: '*EE0D72C1085C46C5278932678FBE2C6A782821B4' encrypted: yes priv: '*.*:ALL' state: present -# Creates database user 'bob' and password '12345' with all database privileges and 'WITH GRANT OPTION' -- mysql_user: +- name: Create database user with password and all database privileges and 'WITH GRANT OPTION' + mysql_user: name: bob password: 12345 priv: '*.*:ALL,GRANT' state: present -# Modify user Bob to require SSL connections. Note that REQUIRESSL is a special privilege that should only apply to *.* by itself. -- mysql_user: +# Note that REQUIRESSL is a special privilege that should only apply to *.* by itself. +- name: Modify user to require SSL connections. + mysql_user: name: bob - append_privs: true + append_privs: yes priv: '*.*:REQUIRESSL' state: present -# Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials. -- mysql_user: +- name: Ensure no user named 'sally'@'localhost' exists, also passing in the auth credentials. + mysql_user: login_user: root login_password: 123456 name: sally state: absent -# Ensure no user named 'sally' exists at all -- mysql_user: +- name: Ensure no user named 'sally' exists at all + mysql_user: name: sally host_all: yes state: absent -# Specify grants composed of more than one word -- mysql_user: +- name: Specify grants composed of more than one word + mysql_user: name: replication password: 12345 priv: "*.*:REPLICATION CLIENT" state: present -# Revoke all privileges for user 'bob' and password '12345' -- mysql_user: +- name: Revoke all privileges for user 'bob' and password '12345' + mysql_user: name: bob password: 12345 priv: "*.*:USAGE" @@ -172,14 +181,14 @@ EXAMPLES = """ # Example privileges string format # mydb.*:INSERT,UPDATE/anotherdb.*:SELECT/yetanotherdb.*:ALL -# Example using login_unix_socket to connect to server -- mysql_user: +- name: Example using login_unix_socket to connect to server + mysql_user: name: root password: abc123 login_unix_socket: /var/run/mysqld/mysqld.sock -# Example of skipping binary logging while adding user 'bob' -- mysql_user: +- name: Example of skipping binary logging while adding user 'bob' + mysql_user: name: bob password: 12345 priv: "*.*:USAGE" @@ -190,11 +199,10 @@ EXAMPLES = """ # [client] # user=root # password=n<_665{vS43y -""" +''' import re import string -import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.database import SQLParseError @@ -535,29 +543,29 @@ def privileges_grant(cursor, user, host, db_table, priv): def main(): module = AnsibleModule( argument_spec=dict( - login_user=dict(default=None), - login_password=dict(default=None, no_log=True), - login_host=dict(default="localhost"), - login_port=dict(default=3306, type='int'), - login_unix_socket=dict(default=None), - user=dict(required=True, aliases=['name']), - password=dict(default=None, no_log=True, type='str'), - encrypted=dict(default=False, type='bool'), - host=dict(default="localhost"), - host_all=dict(type="bool", default="no"), - state=dict(default="present", choices=["absent", "present"]), - priv=dict(default=None), - append_privs=dict(default=False, type='bool'), - check_implicit_admin=dict(default=False, type='bool'), - update_password=dict(default="always", choices=["always", "on_create"]), - connect_timeout=dict(default=30, type='int'), - config_file=dict(default="~/.my.cnf", type='path'), - sql_log_bin=dict(default=True, type='bool'), - ssl_cert=dict(default=None, type='path'), - ssl_key=dict(default=None, type='path'), - ssl_ca=dict(default=None, type='path'), + login_user=dict(type='str'), + login_password=dict(type='str', no_log=True), + login_host=dict(type='str', default='localhost'), + login_port=dict(type='int', default=3306), + login_unix_socket=dict(type='str'), + user=dict(type='str', required=True, aliases=['name']), + password=dict(type='str', no_log=True), + encrypted=dict(type='bool', default=False), + host=dict(type='str', default='localhost'), + host_all=dict(type="bool", default=False), + state=dict(type='str', default='present', choices=['absent', 'present']), + priv=dict(type='str'), + append_privs=dict(type='bool', default=False), + check_implicit_admin=dict(type='bool', default=False), + update_password=dict(type='str', default='always', choices=['always', 'on_create']), + connect_timeout=dict(type='int', default=30), + config_file=dict(type='path', default='~/.my.cnf'), + sql_log_bin=dict(type='bool', default=True), + ssl_cert=dict(type='path'), + ssl_key=dict(type='path'), + ssl_ca=dict(type='path'), ), - supports_check_mode=True + supports_check_mode=True, ) login_user = module.params["login_user"] login_password = module.params["login_password"] @@ -605,7 +613,7 @@ def main(): try: mode = get_mode(cursor) except Exception as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=to_native(e)) try: priv = privileges_unpack(priv, mode) except Exception as e: @@ -620,14 +628,14 @@ def main(): changed = user_mod(cursor, user, host, host_all, None, encrypted, priv, append_privs, module) except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=to_native(e)) else: if host_all: module.fail_json(msg="host_all parameter cannot be used when adding a user") try: changed = user_add(cursor, user, host, host_all, password, encrypted, priv, module.check_mode) except (SQLParseError, InvalidPrivsError, mysql_driver.Error) as e: - module.fail_json(msg=to_native(e), exception=traceback.format_exc()) + module.fail_json(msg=to_native(e)) elif state == "absent": if user_exists(cursor, user, host, host_all): changed = user_delete(cursor, user, host, host_all, module.check_mode) diff --git a/lib/ansible/modules/database/mysql/mysql_variables.py b/lib/ansible/modules/database/mysql/mysql_variables.py index 14507a1aa14..b7e45eba6b8 100644 --- a/lib/ansible/modules/database/mysql/mysql_variables.py +++ b/lib/ansible/modules/database/mysql/mysql_variables.py @@ -1,46 +1,46 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# (c) 2013, Balazs Pocze +# Copyright: (c) 2013, Balazs Pocze # Certain parts are taken from Mark Theunissen's mysqldb module -# # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type - ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: mysql_variables short_description: Manage MySQL global variables description: - - Query / Set MySQL variables + - Query / Set MySQL variables. version_added: 1.3 -author: "Balazs Pocze (@banyek)" +author: +- Balazs Pocze (@banyek) options: variable: description: - Variable name to operate + type: str required: True value: description: - If set, then sets variable value to this - required: False -extends_documentation_fragment: mysql + type: str +extends_documentation_fragment: +- mysql ''' -EXAMPLES = ''' -# Check for sync_binlog setting +EXAMPLES = r''' +- name: Check for sync_binlog setting - mysql_variables: variable: sync_binlog -# Set read_only variable to 1 +- name: Set read_only variable to 1 - mysql_variables: variable: read_only value: 1 @@ -112,19 +112,19 @@ def setvariable(cursor, mysqlvar, value): def main(): module = AnsibleModule( argument_spec=dict( - login_user=dict(default=None), - login_password=dict(default=None, no_log=True), - login_host=dict(default="localhost"), - login_port=dict(default=3306, type='int'), - login_unix_socket=dict(default=None), - variable=dict(default=None), - value=dict(default=None), - ssl_cert=dict(default=None), - ssl_key=dict(default=None), - ssl_ca=dict(default=None), - connect_timeout=dict(default=30, type='int'), - config_file=dict(default="~/.my.cnf", type="path") - ) + login_user=dict(type='str'), + login_password=dict(type='str', no_log=True), + login_host=dict(type='str', default='localhost'), + login_port=dict(type='int', default=3306), + login_unix_socket=dict(type='str'), + variable=dict(type='str'), + value=dict(type='str'), + ssl_cert=dict(type='path'), + ssl_key=dict(type='path'), + ssl_ca=dict(type='path'), + connect_timeout=dict(type='int', default=30), + config_file=dict(type='path', default='~/.my.cnf'), + ), ) user = module.params["login_user"] password = module.params["login_password"] diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index a2d78ed527d..39acbed0f4a 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -1,18 +1,17 @@ #!/usr/bin/python # -*- coding: utf-8 -*- + # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type - ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], 'supported_by': 'community'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: postgresql_db short_description: Add or remove PostgreSQL databases from a remote host. @@ -23,87 +22,100 @@ options: name: description: - name of the database to add or remove + type: str required: true aliases: [ db ] owner: description: - Name of the role to set as owner of the database + type: str template: description: - Template used to create the database + type: str encoding: description: - Encoding of the database + type: str lc_collate: description: - Collation order (LC_COLLATE) to use in the database. Must match collation order of template database unless C(template0) is used as template. + type: str lc_ctype: description: - Character classification (LC_CTYPE) to use in the database (e.g. lower, upper, ...) Must match LC_CTYPE of template database unless C(template0) is used as template. + type: str session_role: + description: + - Switch to session_role after connecting. The specified session_role must be a role that the current login_user is a member of. + - Permissions checking for SQL commands is carried out as though the session_role were the one that had logged in originally. + type: str version_added: "2.8" - description: | - Switch to session_role after connecting. The specified session_role must be a role that the current login_user is a member of. - Permissions checking for SQL commands is carried out as though the session_role were the one that had logged in originally. state: - description: | - The database state. present implies that the database should be created if necessary. - absent implies that the database should be removed if present. - dump requires a target definition to which the database will be backed up. - (Added in 2.4) restore also requires a target definition from which the database will be restored. - (Added in 2.4) The format of the backup will be detected based on the target name. - Supported compression formats for dump and restore are: .bz2, .gz, and .xz - Supported formats for dump and restore are: .sql and .tar + description: + - The database state. + - C(present) implies that the database should be created if necessary. + - C(absent) implies that the database should be removed if present. + - C(dump) requires a target definition to which the database will be backed up. (Added in Ansible 2.4) + - C(restore) also requires a target definition from which the database will be restored. (Added in Ansible 2.4) + - The format of the backup will be detected based on the target name. + - Supported compression formats for dump and restore include C(.bz2), C(.gz) and C(.xz) + - Supported formats for dump and restore include C(.sql) and C(.tar) + type: str + choices: [ absent, dump, present, restore ] default: present - choices: [ "present", "absent", "dump", "restore" ] target: - version_added: "2.4" description: - - File to back up or restore from. Used when state is "dump" or "restore" + - File to back up or restore from. + - Used when I(state) is C(dump) or C(restore). + type: path + version_added: "2.4" target_opts: - version_added: "2.4" description: - - Further arguments for pg_dump or pg_restore. Used when state is "dump" or "restore" + - Further arguments for pg_dump or pg_restore. + - Used when I(state) is C(dump) or C(restore). + type: str + version_added: "2.4" maintenance_db: - version_added: "2.5" description: - The value specifies the initial database (which is also called as maintenance DB) that Ansible connects to. + type: str default: postgres + version_added: "2.5" author: "Ansible Core Team" extends_documentation_fragment: - postgres ''' -EXAMPLES = ''' -# Create a new database with name "acme" -- postgresql_db: +EXAMPLES = r''' +- name: Create a new database with name "acme" + postgresql_db: name: acme -# Create a new database with name "acme" and specific encoding and locale -# settings. If a template different from "template0" is specified, encoding -# and locale settings must match those of the template. -- postgresql_db: +# Note: If a template different from "template0" is specified, encoding and locale settings must match those of the template. +- name: Create a new database with name "acme" and specific encoding and locale # settings. + postgresql_db: name: acme encoding: UTF-8 lc_collate: de_DE.UTF-8 lc_ctype: de_DE.UTF-8 template: template0 -# Dump an existing database to a file -- postgresql_db: +- name: Dump an existing database to a file + postgresql_db: name: acme state: dump target: /tmp/acme.sql -# Dump an existing database to a file (with compression) -- postgresql_db: +- name: Dump an existing database to a file (with compression) + postgresql_db: name: acme state: dump target: /tmp/acme.sql.gz -# Dump a single schema for an existing database -- postgresql_db: +- name: Dump a single schema for an existing database + postgresql_db: name: acme state: dump target: /tmp/acme.sql @@ -366,19 +378,19 @@ def do_with_password(module, cmd, password): def main(): argument_spec = pgutils.postgres_common_argument_spec() - argument_spec.update(dict( - db=dict(required=True, aliases=['name']), - owner=dict(default=""), - template=dict(default=""), - encoding=dict(default=""), - lc_collate=dict(default=""), - lc_ctype=dict(default=""), - state=dict(default="present", choices=["absent", "present", "dump", "restore"]), - target=dict(default="", type="path"), - target_opts=dict(default=""), - maintenance_db=dict(default="postgres"), - session_role=dict(), - )) + argument_spec.update( + db=dict(type='str', required=True, aliases=['name']), + owner=dict(type='str', default=''), + template=dict(type='str', default=''), + encoding=dict(type='str', default=''), + lc_collate=dict(type='str', default=''), + lc_ctype=dict(type='str', default=''), + state=dict(type='str', default='present', choices=['absent', 'dump', 'present', 'restore']), + target=dict(type='path', default=''), + target_opts=dict(type='str', default=''), + maintenance_db=dict(type='str', default="postgres"), + session_role=dict(type='str'), + ) module = AnsibleModule( argument_spec=argument_spec, diff --git a/lib/ansible/modules/net_tools/basics/uri.py b/lib/ansible/modules/net_tools/basics/uri.py index 7898af25b0e..e1c77dc0a0c 100644 --- a/lib/ansible/modules/net_tools/basics/uri.py +++ b/lib/ansible/modules/net_tools/basics/uri.py @@ -159,6 +159,17 @@ options: type: bool default: no version_added: '2.7' + force: + description: + - If C(yes) do not get a cached copy. + type: bool + default: no + aliases: [ thirsty ] + use_proxy: + description: + - If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. + type: bool + default: yes notes: - The dependency on httplib2 was removed in Ansible 2.1. - The module returns all the HTTP headers in lower-case. @@ -489,7 +500,7 @@ def uri(module, url, dest, body, body_format, method, headers, socket_timeout): def main(): argument_spec = url_argument_spec() - argument_spec.update(dict( + argument_spec.update( dest=dict(type='path'), url_username=dict(type='str', aliases=['user']), url_password=dict(type='str', aliases=['password'], no_log=True), @@ -503,8 +514,8 @@ def main(): removes=dict(type='path'), status_code=dict(type='list', default=[200]), timeout=dict(type='int', default=30), - headers=dict(type='dict', default={}) - )) + headers=dict(type='dict', default={}), + ) module = AnsibleModule( argument_spec=argument_spec, diff --git a/lib/ansible/modules/network/meraki/meraki_mr_l3_firewall.py b/lib/ansible/modules/network/meraki/meraki_mr_l3_firewall.py index dec2fd33389..d021745215b 100644 --- a/lib/ansible/modules/network/meraki/meraki_mr_l3_firewall.py +++ b/lib/ansible/modules/network/meraki/meraki_mr_l3_firewall.py @@ -24,28 +24,35 @@ options: state: description: - Create or modify an organization. + type: str + choices: [ present, query ] default: present - choices: [present, query] org_name: description: - Name of organization. + type: str org_id: description: - ID of organization. + type: int net_name: description: - Name of network containing access points. + type: str net_id: description: - ID of network containing access points. + type: str number: description: - Number of SSID to apply firewall rule to. - aliases: [ssid_number] + type: int + aliases: [ ssid_number ] ssid_name: description: - Name of SSID to apply firewall rule to. - aliases: [ssid] + type: str + aliases: [ ssid ] allow_lan_access: description: - Sets whether devices can talk to other devices on the same LAN. @@ -54,24 +61,30 @@ options: rules: description: - List of firewall rules. + type: list suboptions: policy: description: - Specifies the action that should be taken when rule is hit. - choices: [allow, deny] + type: str + choices: [ allow, deny ] protocol: description: - Specifies protocol to match against. - choices: [any, icmp, tcp, udp] + type: str + choices: [ any, icmp, tcp, udp ] dest_port: description: - - Comma separated list of destination ports to match. + - Comma-seperated list of destination ports to match. + type: str dest_cidr: description: - - Comma separated list of CIDR notation networks to match. + - Comma-separated list of CIDR notation networks to match. + type: str comment: description: - Optional comment describing the firewall rule. + type: str author: - Kevin Breit (@kbreit) extends_documentation_fragment: meraki diff --git a/lib/ansible/modules/network/nxos/nxos_pim_interface.py b/lib/ansible/modules/network/nxos/nxos_pim_interface.py index 3eb041fd85e..227f2179b6d 100644 --- a/lib/ansible/modules/network/nxos/nxos_pim_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_pim_interface.py @@ -1,27 +1,13 @@ #!/usr/bin/python -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . -# +# -*- coding: utf-8 -*- + +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'network'} - -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: nxos_pim_interface extends_documentation_fragment: nxos @@ -47,82 +33,92 @@ options: interface: description: - Full name of the interface such as Ethernet1/33. + type: str required: true sparse: description: - Enable/disable sparse-mode on the interface. type: bool - default: 'no' + default: no dr_prio: description: - Configures priority for PIM DR election on interface. + type: str hello_auth_key: description: - Authentication for hellos on this interface. + type: str hello_interval: description: - Hello interval in milliseconds for this interface. - type: bool + type: int jp_policy_out: description: - Policy for join-prune messages (outbound). + type: str jp_policy_in: description: - Policy for join-prune messages (inbound). + type: str jp_type_out: description: - Type of policy mapped to C(jp_policy_out). - choices: ['prefix', 'routemap'] + type: str + choices: [ prefix, routemap ] jp_type_in: description: - Type of policy mapped to C(jp_policy_in). - choices: ['prefix', 'routemap'] + type: str + choices: [ prefix, routemap ] border: description: - Configures interface to be a boundary of a PIM domain. type: bool - default: 'no' + default: no neighbor_policy: description: - Configures a neighbor policy for filtering adjacencies. + type: str neighbor_type: description: - Type of policy mapped to neighbor_policy. - choices: ['prefix', 'routemap'] + type: str + choices: [ prefix, routemap ] state: description: - Manages desired state of the resource. + type: str + choices: [ present, default ] default: present - choices: ['present', 'default'] ''' -EXAMPLES = ''' -# ensure PIM is not running on the interface -- nxos_pim_interface: +EXAMPLES = r''' +- name: Ensure PIM is not running on the interface + nxos_pim_interface: interface: eth1/33 state: absent -# ensure the interface has pim-sm enabled with the appropriate priority and hello interval -- nxos_pim_interface: +- name: Ensure the interface has pim-sm enabled with the appropriate priority and hello interval + nxos_pim_interface: interface: eth1/33 dr_prio: 10 hello_interval: 40 state: present -# ensure join-prune policies exist -- nxos_pim_interface: +- name: Ensure join-prune policies exist + nxos_pim_interface: interface: eth1/33 jp_policy_in: JPIN jp_policy_out: JPOUT jp_type_in: routemap jp_type_out: routemap -# ensure defaults are in place -- nxos_pim_interface: +- name: Ensure defaults are in place + nxos_pim_interface: interface: eth1/33 state: default ''' -RETURN = ''' +RETURN = r''' commands: description: command sent to the device returned: always @@ -436,19 +432,19 @@ def config_pim_interface_defaults(existing, jp_bidir, isauth): def main(): argument_spec = dict( - interface=dict(required=True), + interface=dict(type='str', required=True), sparse=dict(type='bool', default=False), dr_prio=dict(type='str'), hello_auth_key=dict(type='str'), hello_interval=dict(type='int'), jp_policy_out=dict(type='str'), jp_policy_in=dict(type='str'), - jp_type_out=dict(choices=['prefix', 'routemap']), - jp_type_in=dict(choices=['prefix', 'routemap']), + jp_type_out=dict(type='str', choices=['prefix', 'routemap']), + jp_type_in=dict(type='str', choices=['prefix', 'routemap']), border=dict(type='bool', default=False), neighbor_policy=dict(type='str'), - neighbor_type=dict(choices=['prefix', 'routemap']), - state=dict(choices=['present', 'absent', 'default'], default='present'), + neighbor_type=dict(type='str', choices=['prefix', 'routemap']), + state=dict(type='str', default='present', choices=['absent', 'default', 'present']), ) argument_spec.update(nxos_argument_spec) diff --git a/lib/ansible/modules/storage/netapp/na_ontap_nvme.py b/lib/ansible/modules/storage/netapp/na_ontap_nvme.py index c04f278ae7e..92e2f1522b0 100644 --- a/lib/ansible/modules/storage/netapp/na_ontap_nvme.py +++ b/lib/ansible/modules/storage/netapp/na_ontap_nvme.py @@ -1,6 +1,7 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- -# (c) 2019, NetApp, Inc +# Copyright: (c) 2019, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type @@ -10,64 +11,65 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'certified'} -DOCUMENTATION = ''' -author: NetApp Ansible Team (@carchi8py) (ng-ansibleteam@netapp.com) +DOCUMENTATION = r''' +module: na_ontap_nvme +short_description: NetApp ONTAP Manage NVMe Service description: - Create/Delete NVMe Service extends_documentation_fragment: - netapp.na_ontap -module: na_ontap_nvme +author: +- NetApp Ansible Team (@carchi8py) (ng-ansibleteam@netapp.com) options: state: - choices: ['present', 'absent'] description: - Whether the specified NVMe should exist or not. + type: str + choices: [ absent, present ] default: present vserver: description: - Name of the vserver to use. + type: str required: true status_admin: description: - - Whether the status of NVMe should be up or down + - Whether the status of NVMe should be up or down. type: bool -short_description: "NetApp ONTAP Manage NVMe Service" version_added: "2.8" ''' -EXAMPLES = """ +EXAMPLES = r''' +- name: Create NVMe + na_ontap_nvme: + hostname: '{{ hostname }}' + username: '{{ username }}' + password: '{{ password }}' + vserver: '{{ vserver }}' + status_admin: no + state: present - - name: Create NVMe - na_ontap_nvme: - state: present - status_admin: False - vserver: "{{ vserver }}" - hostname: "{{ hostname }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Modify NVMe + na_ontap_nvme: + vserver: '{{ vserver }}' + hostname: '{{ hostname }}' + username: '{{ username }}' + password: '{{ password }}' + status_admin: yes + state: present - - name: Modify NVMe - na_ontap_nvme: - state: present - status_admin: True - vserver: "{{ vserver }}" - hostname: "{{ hostname }}" - username: "{{ username }}" - password: "{{ password }}" +- name: Delete NVMe + na_ontap_nvme: + hostname: '{{ hostname }}' + username: '{{ username }}' + password: '{{ password }}' + vserver: '{{ vserver }}' + state: absent +''' - - name: Delete NVMe - na_ontap_nvme: - state: absent - vserver: "{{ vserver }}" - hostname: "{{ hostname }}" - username: "{{ username }}" - password: "{{ password }}" -""" +RETURN = r''' +''' -RETURN = """ -""" - -import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native import ansible.module_utils.netapp as netapp_utils @@ -84,15 +86,15 @@ class NetAppONTAPNVMe(object): def __init__(self): self.argument_spec = netapp_utils.na_ontap_host_argument_spec() - self.argument_spec.update(dict( - state=dict(required=False, type='str', choices=['present', 'absent'], default='present'), - vserver=dict(required=True, type='str'), - status_admin=dict(required=False, type=bool) - )) + self.argument_spec.update( + state=dict(type='str', default='present', choices=['absent', 'present']), + vserver=dict(type='str', required=True), + status_admin=dict(type='bool'), + ) self.module = AnsibleModule( argument_spec=self.argument_spec, - supports_check_mode=True + supports_check_mode=True, ) self.na_helper = NetAppModule() @@ -120,8 +122,7 @@ class NetAppONTAPNVMe(object): try: result = self.server.invoke_successfully(nvme_get, enable_tunneling=False) except netapp_utils.zapi.NaApiError as error: - self.module.fail_json(msg='Error fetching nvme info: %s' % to_native(error), - exception=traceback.format_exc()) + self.module.fail_json(msg='Error fetching nvme info: %s' % to_native(error)) if result.get_child_by_name('num-records') and int(result.get_child_content('num-records')) >= 1: attributes_list = result.get_child_by_name('attributes-list') nvme_info = attributes_list.get_child_by_name('nvme-target-service-info') @@ -141,8 +142,7 @@ class NetAppONTAPNVMe(object): self.server.invoke_successfully(nvme_create, enable_tunneling=True) except netapp_utils.zapi.NaApiError as error: self.module.fail_json(msg='Error creating nvme for vserver %s: %s' - % (self.parameters['vserver'], to_native(error)), - exception=traceback.format_exc()) + % (self.parameters['vserver'], to_native(error))) def delete_nvme(self): """ @@ -153,8 +153,7 @@ class NetAppONTAPNVMe(object): self.server.invoke_successfully(nvme_delete, enable_tunneling=True) except netapp_utils.zapi.NaApiError as error: self.module.fail_json(msg='Error deleting nvme for vserver %s: %s' - % (self.parameters['vserver'], to_native(error)), - exception=traceback.format_exc()) + % (self.parameters['vserver'], to_native(error))) def modify_nvme(self, status=None): """ @@ -169,8 +168,7 @@ class NetAppONTAPNVMe(object): self.server.invoke_successfully(nvme_modify, enable_tunneling=True) except netapp_utils.zapi.NaApiError as error: self.module.fail_json(msg='Error modifying nvme for vserver %s: %s' - % (self.parameters['vserver'], to_native(error)), - exception=traceback.format_exc()) + % (self.parameters['vserver'], to_native(error))) def apply(self): """ diff --git a/lib/ansible/plugins/doc_fragments/avi.py b/lib/ansible/plugins/doc_fragments/avi.py index 098e2cef101..5c4fac1e6e2 100644 --- a/lib/ansible/plugins/doc_fragments/avi.py +++ b/lib/ansible/plugins/doc_fragments/avi.py @@ -43,13 +43,13 @@ options: avi_credentials: description: - Avi Credentials dictionary which can be used in lieu of enumerating Avi Controller login details. - type: str + type: dict version_added: "2.5" api_context: description: - Avi API context that includes current session ID and CSRF Token. - This allows user to perform single login and re-use the session. - type: str + type: dict version_added: "2.5" notes: - For more information on using Ansible to manage Avi Network devices see U(https://www.ansible.com/ansible-avi-networks). diff --git a/lib/ansible/plugins/doc_fragments/azure_tags.py b/lib/ansible/plugins/doc_fragments/azure_tags.py index 78f51027849..ea4268c8ca3 100644 --- a/lib/ansible/plugins/doc_fragments/azure_tags.py +++ b/lib/ansible/plugins/doc_fragments/azure_tags.py @@ -15,7 +15,7 @@ options: - Dictionary of string:string pairs to assign as metadata to the object. - Metadata tags on the object will be updated with any provided values. - To remove tags set append_tags option to false. - type: str + type: dict append_tags: description: - Use to control if tags field is canonical or just appends to existing tags. diff --git a/lib/ansible/plugins/doc_fragments/cnos.py b/lib/ansible/plugins/doc_fragments/cnos.py index 184315432be..506e6569162 100644 --- a/lib/ansible/plugins/doc_fragments/cnos.py +++ b/lib/ansible/plugins/doc_fragments/cnos.py @@ -15,7 +15,7 @@ options: template file and each response from the device are saved here. Usually the location is the results folder, but you can choose another location based on your write permission. - type: path + type: str required: true version_added: '2.3' host: diff --git a/lib/ansible/plugins/doc_fragments/influxdb.py b/lib/ansible/plugins/doc_fragments/influxdb.py index 4c40414ac78..0489ff7ae6c 100644 --- a/lib/ansible/plugins/doc_fragments/influxdb.py +++ b/lib/ansible/plugins/doc_fragments/influxdb.py @@ -72,6 +72,6 @@ options: proxies: description: - HTTP(S) proxy to use for Requests to connect to InfluxDB server. - type: str + type: dict version_added: "2.5" ''' diff --git a/lib/ansible/plugins/doc_fragments/meraki.py b/lib/ansible/plugins/doc_fragments/meraki.py index 3a817e3dd67..d8198dbfd0e 100644 --- a/lib/ansible/plugins/doc_fragments/meraki.py +++ b/lib/ansible/plugins/doc_fragments/meraki.py @@ -55,5 +55,5 @@ options: org_id: description: - ID of organization. - type: str + type: int ''' diff --git a/lib/ansible/plugins/doc_fragments/mysql.py b/lib/ansible/plugins/doc_fragments/mysql.py index ffc01825fdc..f22b464527e 100644 --- a/lib/ansible/plugins/doc_fragments/mysql.py +++ b/lib/ansible/plugins/doc_fragments/mysql.py @@ -25,7 +25,7 @@ options: login_port: description: - Port of the MySQL server. Requires I(login_host) be defined as other than localhost if login_port is used. - type: str + type: int default: 3306 login_unix_socket: description: diff --git a/lib/ansible/plugins/doc_fragments/netscaler.py b/lib/ansible/plugins/doc_fragments/netscaler.py index bf36d84d3bd..98d464e36f9 100644 --- a/lib/ansible/plugins/doc_fragments/netscaler.py +++ b/lib/ansible/plugins/doc_fragments/netscaler.py @@ -42,7 +42,7 @@ options: nitro_timeout: description: - Time in seconds until a timeout error is thrown when establishing a new session with Netscaler - type: int + type: float default: 310 state: diff --git a/lib/ansible/plugins/doc_fragments/openstack.py b/lib/ansible/plugins/doc_fragments/openstack.py index 0cf5bba5920..b07138cb3aa 100644 --- a/lib/ansible/plugins/doc_fragments/openstack.py +++ b/lib/ansible/plugins/doc_fragments/openstack.py @@ -18,7 +18,7 @@ options: or if OpenStack OS_* environment variables are present. If I(cloud) is a dict, it contains a complete cloud configuration like would be in a section of clouds.yaml. - type: str + type: raw auth: description: - Dictionary containing auth information as needed by the cloud's auth @@ -28,7 +28,7 @@ options: this param will need to contain whatever parameters that auth plugin requires. This parameter is not needed if a named cloud is provided or OpenStack OS_* environment variables are present. - type: str + type: dict auth_type: description: - Name of the auth plugin to use. If the cloud uses something other than @@ -65,15 +65,15 @@ options: description: - A path to a CA Cert bundle that can be used as part of verifying SSL API requests. - type: path + type: str cert: description: - A path to a client certificate to use as part of the SSL transaction. - type: path + type: str key: description: - A path to a client key to use as part of the SSL transaction. - type: path + type: str interface: description: - Endpoint URL type to fetch from the service catalog. diff --git a/lib/ansible/plugins/doc_fragments/postgres.py b/lib/ansible/plugins/doc_fragments/postgres.py index a579e30dec0..8a5f244a562 100644 --- a/lib/ansible/plugins/doc_fragments/postgres.py +++ b/lib/ansible/plugins/doc_fragments/postgres.py @@ -23,7 +23,7 @@ options: login_unix_socket: description: - Path to a Unix domain socket for local connections. - type: path + type: str port: description: - Database port to connect to. @@ -42,7 +42,7 @@ options: description: - Specifies the name of a file containing SSL certificate authority (CA) certificate(s). - If the file exists, the server's certificate will be verified to be signed by one of these authorities. - type: path + type: str version_added: '2.3' notes: - The default authentication assumes that you are either logging in as or sudo'ing to the C(postgres) account on the host. diff --git a/lib/ansible/plugins/doc_fragments/url.py b/lib/ansible/plugins/doc_fragments/url.py index d4f7fe4e95f..efbf39bd160 100644 --- a/lib/ansible/plugins/doc_fragments/url.py +++ b/lib/ansible/plugins/doc_fragments/url.py @@ -16,10 +16,9 @@ options: force: description: - If C(yes) do not get a cached copy. - aliases: - - thirsty type: bool default: no + aliases: [ thirsty ] http_agent: description: - Header to identify as, generally appears in web server logs. diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index a7964c10a4e..c2347874053 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -369,8 +369,6 @@ lib/ansible/modules/database/mongodb/mongodb_parameter.py E317 lib/ansible/modules/database/mongodb/mongodb_parameter.py E323 lib/ansible/modules/database/mongodb/mongodb_parameter.py E326 lib/ansible/modules/database/mongodb/mongodb_user.py E322 -lib/ansible/modules/database/mysql/mysql_replication.py E325 -lib/ansible/modules/database/mysql/mysql_replication.py E326 lib/ansible/modules/database/mysql/mysql_user.py E322 lib/ansible/modules/database/mysql/mysql_db.py E210 lib/ansible/modules/database/postgresql/postgresql_ext.py E322 @@ -455,7 +453,6 @@ lib/ansible/modules/net_tools/basics/slurp.py E322 lib/ansible/modules/net_tools/basics/uri.py E322 lib/ansible/modules/net_tools/basics/uri.py E323 lib/ansible/modules/net_tools/basics/uri.py E324 -lib/ansible/modules/net_tools/basics/uri.py E325 lib/ansible/modules/net_tools/basics/uri.py E326 lib/ansible/modules/net_tools/cloudflare_dns.py E317 lib/ansible/modules/net_tools/cloudflare_dns.py E327