diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_group.py b/lib/ansible/modules/monitoring/zabbix/zabbix_group.py index 40f98124229..451f2a4f1e3 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_group.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_group.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_group short_description: Create/delete Zabbix host groups @@ -33,12 +33,15 @@ options: description: - Create or delete host group. required: false + type: str default: "present" choices: [ "present", "absent" ] host_groups: description: - List of host groups to create or delete. required: true + type: list + elements: str aliases: [ "host_group" ] extends_documentation_fragment: @@ -48,7 +51,7 @@ notes: - Too many concurrent updates to the same group may cause Zabbix to return errors, see examples for a workaround if needed. ''' -EXAMPLES = ''' +EXAMPLES = r''' # Base create host groups example - name: Create host groups local_action: @@ -144,7 +147,7 @@ def main(): http_login_password=dict(type='str', required=False, default=None, no_log=True), validate_certs=dict(type='bool', required=False, default=True), host_groups=dict(type='list', required=True, aliases=['host_group']), - state=dict(default="present", choices=['present', 'absent']), + state=dict(type='str', default="present", choices=['present', 'absent']), timeout=dict(type='int', default=10) ), supports_check_mode=True diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_group_info.py b/lib/ansible/modules/monitoring/zabbix/zabbix_group_info.py index 6bca8160429..300333be0e1 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_group_info.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_group_info.py @@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} -RETURN = ''' +RETURN = r''' --- host_groups: description: List of Zabbix groups. @@ -21,7 +21,7 @@ host_groups: sample: [ { "flags": "0", "groupid": "33", "internal": "0", "name": "Hostgruup A" } ] ''' -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_group_info short_description: Gather information about Zabbix hostgroup @@ -40,11 +40,13 @@ options: - Name of the hostgroup in Zabbix. - hostgroup is the unique identifier used and cannot be updated using this module. required: true + type: list + elements: str extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Get hostgroup info local_action: module: zabbix_group_info diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_host.py b/lib/ansible/modules/monitoring/zabbix/zabbix_host.py index feff21df200..f3db7556460 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_host.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_host.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_host short_description: Create/update/delete Zabbix hosts @@ -35,36 +35,46 @@ options: - Name of the host in Zabbix. - I(host_name) is the unique identifier used and cannot be updated using this module. required: true + type: str visible_name: description: - Visible name of the host in Zabbix. version_added: '2.3' + type: str description: description: - Description of the host in Zabbix. version_added: '2.5' + type: str host_groups: description: - List of host groups the host is part of. + type: list + elements: str link_templates: description: - List of templates linked to the host. + type: list + elements: str inventory_mode: description: - Configure the inventory mode. choices: ['automatic', 'manual', 'disabled'] version_added: '2.1' + type: str inventory_zabbix: description: - Add Facts for a zabbix inventory (e.g. Tag) (see example below). - Please review the interface documentation for more information on the supported properties - U(https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object#host_inventory) version_added: '2.5' + type: dict status: description: - Monitoring status of the host. choices: ['enabled', 'disabled'] default: 'enabled' + type: str state: description: - State of the host. @@ -72,11 +82,14 @@ options: - On C(absent) will remove a host if it exists. choices: ['present', 'absent'] default: 'present' + type: str proxy: description: - The name of the Zabbix proxy to be used. + type: str interfaces: type: list + elements: dict description: - List of interfaces to be created for the host (see example below). - For more information, review host interface documentation at @@ -143,6 +156,7 @@ options: - Works only with >= Zabbix 3.0 default: 1 version_added: '2.5' + type: int tls_accept: description: - Specifies what types of connections are allowed for incoming connections. @@ -152,29 +166,34 @@ options: - Works only with >= Zabbix 3.0 default: 1 version_added: '2.5' + type: int tls_psk_identity: description: - It is a unique name by which this specific PSK is referred to by Zabbix components - Do not put sensitive information in the PSK identity string, it is transmitted over the network unencrypted. - Works only with >= Zabbix 3.0 version_added: '2.5' + type: str tls_psk: description: - PSK value is a hard to guess string of hexadecimal digits. - The preshared key, at least 32 hex digits. Required if either I(tls_connect) or I(tls_accept) has PSK enabled. - Works only with >= Zabbix 3.0 version_added: '2.5' + type: str ca_cert: description: - Required certificate issuer. - Works only with >= Zabbix 3.0 version_added: '2.5' aliases: [ tls_issuer ] + type: str tls_subject: description: - Required certificate subject. - Works only with >= Zabbix 3.0 version_added: '2.5' + type: str ipmi_authtype: description: - IPMI authentication algorithm. @@ -186,6 +205,7 @@ options: any of the I(ipmi_)-options; this means that if you attempt to set any of the four options individually, the rest will be reset to default values. version_added: '2.5' + type: int ipmi_privilege: description: - IPMI privilege level. @@ -195,16 +215,19 @@ options: being the API default. - also see the last note in the I(ipmi_authtype) documentation version_added: '2.5' + type: int ipmi_username: description: - IPMI username. - also see the last note in the I(ipmi_authtype) documentation version_added: '2.5' + type: str ipmi_password: description: - IPMI password. - also see the last note in the I(ipmi_authtype) documentation version_added: '2.5' + type: str force: description: - Overwrite the host configuration, even if already present. @@ -215,7 +238,7 @@ extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a new host or update an existing host's info local_action: module: zabbix_host @@ -671,9 +694,9 @@ def main(): validate_certs=dict(type='bool', required=False, default=True), host_groups=dict(type='list', required=False), link_templates=dict(type='list', required=False), - status=dict(default="enabled", choices=['enabled', 'disabled']), - state=dict(default="present", choices=['present', 'absent']), - inventory_mode=dict(required=False, choices=['automatic', 'manual', 'disabled']), + status=dict(type='str', default="enabled", choices=['enabled', 'disabled']), + state=dict(type='str', default="present", choices=['present', 'absent']), + inventory_mode=dict(type='str', required=False, choices=['automatic', 'manual', 'disabled']), ipmi_authtype=dict(type='int', default=None), ipmi_privilege=dict(type='int', default=None), ipmi_username=dict(type='str', required=False, default=None), @@ -684,7 +707,7 @@ def main(): tls_psk=dict(type='str', required=False), ca_cert=dict(type='str', required=False, aliases=['tls_issuer']), tls_subject=dict(type='str', required=False), - inventory_zabbix=dict(required=False, type='dict'), + inventory_zabbix=dict(type='dict', required=False), timeout=dict(type='int', default=10), interfaces=dict(type='list', required=False), force=dict(type='bool', default=True), diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py index a43c1036572..b8fa00fa29a 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} -RETURN = ''' +RETURN = r''' --- hosts: description: List of Zabbix hosts. See https://www.zabbix.com/documentation/4.0/manual/api/reference/host/get for list of host values. @@ -22,7 +22,7 @@ hosts: sample: [ { "available": "1", "description": "", "disable_until": "0", "error": "", "flags": "0", "groups": ["1"], "host": "Host A", ... } ] ''' -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_host_info short_description: Gather information about Zabbix host @@ -40,11 +40,16 @@ options: description: - Name of the host in Zabbix. - host_name is the unique identifier used and cannot be updated using this module. - required: true + - Required when I(host_ip) is not used. + required: false + type: str host_ip: description: - Host interface IP of the host in Zabbix. + - Required when I(host_name) is not used. required: false + type: list + elements: str exact_match: description: - Find the exact match @@ -60,13 +65,14 @@ options: - List of host inventory keys to display in result. - Whole host inventory is retrieved if keys are not specified. type: list + elements: str required: false version_added: 2.8 extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Get host info local_action: module: zabbix_host_info diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py b/lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py index c2644f6cc25..088588ed567 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_hostmacro short_description: Create/update/delete Zabbix host macros @@ -31,14 +31,17 @@ options: description: - Name of the host. required: true + type: str macro_name: description: - Name of the host macro in zabbix native format C({$MACRO}) or simple format C(MACRO). required: true + type: str macro_value: description: - Value of the host macro. - Required if I(state=present). + type: str state: description: - State of the macro. @@ -46,6 +49,7 @@ options: - On C(absent) will remove a macro if it exists. required: false choices: ['present', 'absent'] + type: str default: "present" force: description: @@ -58,7 +62,7 @@ extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create new host macro or update an existing macro's value local_action: module: zabbix_hostmacro @@ -198,7 +202,7 @@ def main(): host_name=dict(type='str', required=True), macro_name=dict(type='str', required=True), macro_value=dict(type='str', required=False), - state=dict(default="present", choices=['present', 'absent']), + state=dict(type='str', default='present', choices=['present', 'absent']), timeout=dict(type='int', default=10), force=dict(type='bool', default=True) ), diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py b/lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py index 310f201423d..e58da2603c8 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: zabbix_maintenance short_description: Create Zabbix maintenance windows @@ -30,35 +30,36 @@ options: - Create or remove a maintenance window. Maintenance window to remove is identified by name. default: present choices: [ "present", "absent" ] + type: str host_names: description: - Hosts to manage maintenance window for. - Separate multiple hosts with commas. - C(host_name) is an alias for C(host_names). - B(Required) option when C(state) is I(present) - and no C(host_groups) specified. + - B(Required) option when I(state=present) and I(host_groups) is not used. aliases: [ "host_name" ] + type: list + elements: str host_groups: description: - Host groups to manage maintenance window for. - Separate multiple groups with commas. - C(host_group) is an alias for C(host_groups). - B(Required) option when C(state) is I(present) - and no C(host_names) specified. + - B(Required) option when I(state=present) and I(host_names) is not used. aliases: [ "host_group" ] + type: list + elements: str minutes: description: - Length of maintenance window in minutes. default: 10 + type: int name: description: - Unique name of maintenance window. required: true + type: str desc: description: - Short description of maintenance window. - required: true default: Created by Ansible + type: str collect_data: description: - Type of maintenance. With data collection, or without. @@ -77,7 +78,7 @@ notes: - Install required module with 'pip install zabbix-api' command. ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a named maintenance window for host www1 for 90 minutes zabbix_maintenance: name: Update of www1 @@ -273,8 +274,8 @@ def get_host_ids(zbx, host_names): def main(): module = AnsibleModule( argument_spec=dict( - state=dict(required=False, default='present', choices=['present', 'absent']), - server_url=dict(type='str', required=True, default=None, aliases=['url']), + state=dict(type='str', required=False, default='present', choices=['present', 'absent']), + server_url=dict(type='str', required=True, aliases=['url']), host_names=dict(type='list', required=False, default=None, aliases=['host_name']), minutes=dict(type='int', required=False, default=10), host_groups=dict(type='list', required=False, default=None, aliases=['host_group']), @@ -362,7 +363,7 @@ def main(): if module.check_mode: changed = True else: - (rc, _, error) = update_maintenance(zbx, maintenance["maintenanceid"], group_ids, host_ids, start_time, maintenance_type, period, desc) + (rc, data, error) = update_maintenance(zbx, maintenance["maintenanceid"], group_ids, host_ids, start_time, maintenance_type, period, desc) if rc == 0: changed = True else: @@ -372,7 +373,7 @@ def main(): if module.check_mode: changed = True else: - (rc, _, error) = create_maintenance(zbx, group_ids, host_ids, start_time, maintenance_type, period, name, desc) + (rc, data, error) = create_maintenance(zbx, group_ids, host_ids, start_time, maintenance_type, period, name, desc) if rc == 0: changed = True else: @@ -388,7 +389,7 @@ def main(): if module.check_mode: changed = True else: - (rc, _, error) = delete_maintenance(zbx, maintenance["maintenanceid"]) + (rc, data, error) = delete_maintenance(zbx, maintenance["maintenanceid"]) if rc == 0: changed = True else: diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_map.py b/lib/ansible/modules/monitoring/zabbix/zabbix_map.py index 9926126f4a3..bfd59609d69 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_map.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_map.py @@ -7,7 +7,7 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_map author: @@ -50,11 +50,13 @@ options: - Name of the map. required: true aliases: [ "map_name" ] + type: str data: description: - Graph written in DOT language. required: false aliases: [ "dot_data" ] + type: str state: description: - State of the map. @@ -63,21 +65,25 @@ options: required: false choices: ['present', 'absent'] default: "present" + type: str width: description: - Width of the map. required: false default: 800 + type: int height: description: - Height of the map. required: false default: 600 + type: int margin: description: - Size of white space between map's borders and its elements. required: false default: 40 + type: int expand_problem: description: - Whether the problem trigger will be displayed for elements with a single problem. @@ -96,19 +102,21 @@ options: required: false choices: ['label', 'ip', 'name', 'status', 'nothing', 'custom'] default: "name" + type: str default_image: description: - Name of the Zabbix image used to display the element if this element doesn't have the C(zbx_image) attribute defined. required: false aliases: [ "image" ] + type: str extends_documentation_fragment: - zabbix ''' -RETURN = ''' # ''' +RETURN = r''' # ''' -EXAMPLES = ''' +EXAMPLES = r''' ### ### Example inventory: # [web] @@ -758,7 +766,7 @@ def main(): data=dict(type='str', required=False, aliases=['dot_data']), width=dict(type='int', default=800), height=dict(type='int', default=600), - state=dict(default="present", choices=['present', 'absent']), + state=dict(type='str', default="present", choices=['present', 'absent']), default_image=dict(type='str', required=False, aliases=['image']), margin=dict(type='int', default=40), expand_problem=dict(type='bool', default=True), diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_mediatype.py b/lib/ansible/modules/monitoring/zabbix/zabbix_mediatype.py index 2cc0580ac47..9cc6912a466 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_mediatype.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_mediatype.py @@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_mediatype short_description: Create/Update/Delete Zabbix media types @@ -40,7 +40,6 @@ options: - present - absent default: 'present' - required: true type: type: 'str' description: @@ -85,6 +84,7 @@ options: - Required when I(type=script). script_params: type: 'list' + elements: str description: - List of script parameters. - Required when I(type=script). @@ -168,10 +168,9 @@ extends_documentation_fragment: ''' -RETURN = ''' -''' +RETURN = r''' # ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: 'Create an email mediatype with SMTP authentication' zabbix_mediatype: name: "Ops email" diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py b/lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py index df2ba3552f6..072b04dae06 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py @@ -25,7 +25,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_proxy short_description: Create/delete/get/update Zabbix proxies @@ -42,6 +42,7 @@ options: description: - Name of the proxy in Zabbix. required: true + type: str proxy_address: description: - Comma-delimited list of IP/CIDR addresses or DNS names to accept active proxy requests from. @@ -49,45 +50,54 @@ options: - Works only with >= Zabbix 4.0. ( remove option for <= 4.0 ) required: false version_added: '2.10' + type: str description: description: - Description of the proxy. required: false + type: str status: description: - Type of proxy. (4 - active, 5 - passive) required: false choices: ['active', 'passive'] default: "active" + type: str tls_connect: description: - Connections to proxy. required: false choices: ['no_encryption','PSK','certificate'] default: 'no_encryption' + type: str tls_accept: description: - Connections from proxy. required: false choices: ['no_encryption','PSK','certificate'] default: 'no_encryption' + type: str ca_cert: description: - Certificate issuer. required: false aliases: [ tls_issuer ] + type: str tls_subject: description: - Certificate subject. required: false + type: str tls_psk_identity: description: - PSK identity. Required if either I(tls_connect) or I(tls_accept) has PSK enabled. required: false + type: str tls_psk: description: - The preshared key, at least 32 hex digits. Required if either I(tls_connect) or I(tls_accept) has PSK enabled. required: false + type: str state: description: - State of the proxy. @@ -96,6 +106,7 @@ options: required: false choices: ['present', 'absent'] default: "present" + type: str interface: description: - Dictionary with params for the interface when proxy is in passive mode @@ -104,12 +115,13 @@ options: - U(https://www.zabbix.com/documentation/3.2/manual/api/reference/proxy/object#proxy_interface) required: false default: {} + type: dict extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a new proxy or update an existing proxy local_action: module: zabbix_proxy @@ -130,7 +142,7 @@ EXAMPLES = ''' port: 10050 ''' -RETURN = ''' # ''' +RETURN = r''' # ''' import traceback @@ -267,12 +279,12 @@ def main(): http_login_password=dict(type='str', required=False, default=None, no_log=True), validate_certs=dict(type='bool', required=False, default=True), - status=dict(default="active", choices=['active', 'passive']), - state=dict(default="present", choices=['present', 'absent']), + status=dict(type='str', default="active", choices=['active', 'passive']), + state=dict(type='str', default="present", choices=['present', 'absent']), description=dict(type='str', required=False), - tls_connect=dict(default='no_encryption', + tls_connect=dict(type='str', default='no_encryption', choices=['no_encryption', 'PSK', 'certificate']), - tls_accept=dict(default='no_encryption', + tls_accept=dict(type='str', default='no_encryption', choices=['no_encryption', 'PSK', 'certificate']), ca_cert=dict(type='str', required=False, default=None, aliases=['tls_issuer']), tls_subject=dict(type='str', required=False, default=None), diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_screen.py b/lib/ansible/modules/monitoring/zabbix/zabbix_screen.py index 5899da88968..60db441776e 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_screen.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_screen.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_screen short_description: Create/update/delete Zabbix screens @@ -32,6 +32,7 @@ options: description: - List of screens to be created/updated/deleted (see example). type: list + elements: dict required: true suboptions: screen_name: @@ -39,13 +40,12 @@ options: - Screen name will be used. - If a screen has already been added, the screen name won't be updated. type: str - required: yes + required: true host_group: description: - Host group will be used for searching hosts. - Required if I(state=present). type: str - required: yes state: description: - I(present) - Create a screen if it doesn't exist. If the screen already exists, the screen will be updated as needed. @@ -60,6 +60,7 @@ options: - Graph names will be added to a screen. Case insensitive. - Required if I(state=present). type: list + elements: str graph_width: description: - Graph width will be set in graph settings. @@ -87,7 +88,7 @@ notes: - Too many concurrent updates to the same screen may cause Zabbix to return errors, see examples for a workaround if needed. ''' -EXAMPLES = ''' +EXAMPLES = r''' # Create/update a screen. - name: Create a new screen or update an existing screen's items 5 in a row local_action: @@ -350,16 +351,24 @@ def main(): http_login_password=dict(type='str', required=False, default=None, no_log=True), validate_certs=dict(type='bool', required=False, default=True), timeout=dict(type='int', default=10), - screens=dict(type='list', elements='dict', required=True, options=dict( - screen_name=dict(type='str', required=True), - host_group=dict(type='str'), - state=dict(type='str', default='present', choices=['absent', 'present']), - graph_names=dict(type='list', elements='str'), - graph_width=dict(type='int', default=None), - graph_height=dict(type='int', default=None), - graphs_in_row=dict(type='int', default=3), - sort=dict(default=False, type='bool'), - )) + screens=dict( + type='list', + elements='dict', + required=True, + options=dict( + screen_name=dict(type='str', required=True), + host_group=dict(type='str'), + state=dict(type='str', default='present', choices=['absent', 'present']), + graph_names=dict(type='list', elements='str'), + graph_width=dict(type='int', default=None), + graph_height=dict(type='int', default=None), + graphs_in_row=dict(type='int', default=3), + sort=dict(default=False, type='bool'), + ), + required_if=[ + ['state', 'present', ['host_group']] + ] + ) ), supports_check_mode=True ) diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_template.py b/lib/ansible/modules/monitoring/zabbix/zabbix_template.py index 1d316a4a6b0..ae60cfa82f4 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_template.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_template.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_template short_description: Create/update/delete/dump Zabbix template @@ -35,6 +35,7 @@ options: - Required when I(template_json) or I(template_xml) are not used. - Mutually exclusive with I(template_json) and I(template_xml). required: false + type: str template_json: description: - JSON dump of templates to import. @@ -52,6 +53,7 @@ options: - Mutually exclusive with I(template_name) and I(template_json). required: false version_added: '2.9' + type: str template_groups: description: - List of host groups to add template to when template is created. @@ -60,6 +62,7 @@ options: Not required when updating an existing template. required: false type: list + elements: str link_templates: description: - List of template names to be linked to the template. @@ -67,12 +70,14 @@ options: cleared from the template. required: false type: list + elements: str clear_templates: description: - List of template names to be unlinked and cleared from the template. - This option is ignored if template is being created for the first time. required: false type: list + elements: str macros: description: - List of user macros to create for the template. @@ -80,14 +85,17 @@ options: - See examples on how to pass macros. required: false type: list + elements: dict suboptions: name: description: - Name of the macro. - Must be specified in {$NAME} format. + type: str value: description: - Value of the macro. + type: str dump_format: description: - Format to use when dumping template with C(state=dump). @@ -96,6 +104,7 @@ options: choices: [json, xml] default: "json" version_added: '2.9' + type: str state: description: - Required state of the template. @@ -106,12 +115,13 @@ options: required: false choices: [present, absent, dump] default: "present" + type: str extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' --- - name: Create a new Zabbix template linked to groups, macros and templates local_action: @@ -226,7 +236,7 @@ EXAMPLES = ''' register: template_dump ''' -RETURN = ''' +RETURN = r''' --- template_json: description: The JSON dump of the template @@ -611,7 +621,7 @@ def main(): clear_templates=dict(type='list', required=False), macros=dict(type='list', required=False), dump_format=dict(type='str', required=False, default='json', choices=['json', 'xml']), - state=dict(default="present", choices=['present', 'absent', 'dump']), + state=dict(type='str', default="present", choices=['present', 'absent', 'dump']), timeout=dict(type='int', default=10) ), required_one_of=[ diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_user.py b/lib/ansible/modules/monitoring/zabbix/zabbix_user.py index d2356b99a9d..9b167bf1fb6 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_user.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_user.py @@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' module: zabbix_user short_description: Create/update/delete Zabbix users author: @@ -43,7 +43,9 @@ options: usrgrps: description: - User groups to add the user to. + required: true type: list + elements: str passwd: description: - User's password. @@ -183,6 +185,7 @@ options: default: true type: bool type: list + elements: dict type: description: - Type of the user. @@ -204,7 +207,7 @@ extends_documentation_fragment: - zabbix ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: create of zabbix user. zabbix_user: server_url: "http://zabbix.example.com/zabbix/" @@ -253,7 +256,7 @@ EXAMPLES = ''' state: absent ''' -RETURN = ''' +RETURN = r''' user_ids: description: User id created or changed returned: success diff --git a/lib/ansible/modules/monitoring/zabbix/zabbix_valuemap.py b/lib/ansible/modules/monitoring/zabbix/zabbix_valuemap.py index 3761b73a1e1..2624b889a86 100644 --- a/lib/ansible/modules/monitoring/zabbix/zabbix_valuemap.py +++ b/lib/ansible/modules/monitoring/zabbix/zabbix_valuemap.py @@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'supported_by': 'community'} -DOCUMENTATION = ''' +DOCUMENTATION = r''' --- module: zabbix_valuemap short_description: Create/update/delete Zabbix value maps @@ -40,9 +40,10 @@ options: default: 'present' mappings: type: 'list' + elements: dict description: - List of value mappings for the value map. - required: true + - Required when I(state=present). suboptions: value: type: 'str' @@ -57,10 +58,10 @@ extends_documentation_fragment: - zabbix ''' -RETURN = ''' +RETURN = r''' ''' -EXAMPLES = ''' +EXAMPLES = r''' - name: Create a value map local_action: module: zabbix_valuemap diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 5c8e14140d9..62d1dab4257 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -1934,30 +1934,6 @@ lib/ansible/modules/monitoring/zabbix/zabbix_action.py validate-modules:doc-requ lib/ansible/modules/monitoring/zabbix/zabbix_action.py validate-modules:missing-suboption-docs lib/ansible/modules/monitoring/zabbix/zabbix_action.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/monitoring/zabbix/zabbix_action.py validate-modules:undocumented-parameter -lib/ansible/modules/monitoring/zabbix/zabbix_group.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_group.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_group_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_host.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_host.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py validate-modules:doc-required-mismatch -lib/ansible/modules/monitoring/zabbix/zabbix_host_info.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_hostmacro.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py pylint:blacklisted-name -lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py validate-modules:doc-required-mismatch -lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py validate-modules:no-default-for-required-parameter -lib/ansible/modules/monitoring/zabbix/zabbix_maintenance.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_map.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_map.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_mediatype.py validate-modules:doc-required-mismatch -lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_proxy.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_screen.py validate-modules:doc-required-mismatch -lib/ansible/modules/monitoring/zabbix/zabbix_template.py validate-modules:doc-missing-type -lib/ansible/modules/monitoring/zabbix/zabbix_template.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/monitoring/zabbix/zabbix_user.py validate-modules:doc-required-mismatch -lib/ansible/modules/monitoring/zabbix/zabbix_valuemap.py validate-modules:doc-required-mismatch lib/ansible/modules/net_tools/basics/get_url.py validate-modules:parameter-type-not-in-doc lib/ansible/modules/net_tools/basics/uri.py pylint:blacklisted-name lib/ansible/modules/net_tools/basics/uri.py validate-modules:doc-required-mismatch