adjusted doc and argument spec in zabbix modules to match sanity requirements (#66176)

This commit is contained in:
Dusan Matejka 2020-01-11 15:25:15 +01:00 committed by Felix Fontein
parent 515c4a7e2c
commit 3456700420
14 changed files with 157 additions and 100 deletions

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_group module: zabbix_group
short_description: Create/delete Zabbix host groups short_description: Create/delete Zabbix host groups
@ -33,12 +33,15 @@ options:
description: description:
- Create or delete host group. - Create or delete host group.
required: false required: false
type: str
default: "present" default: "present"
choices: [ "present", "absent" ] choices: [ "present", "absent" ]
host_groups: host_groups:
description: description:
- List of host groups to create or delete. - List of host groups to create or delete.
required: true required: true
type: list
elements: str
aliases: [ "host_group" ] aliases: [ "host_group" ]
extends_documentation_fragment: 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. - 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 # Base create host groups example
- name: Create host groups - name: Create host groups
local_action: local_action:
@ -144,7 +147,7 @@ def main():
http_login_password=dict(type='str', required=False, default=None, no_log=True), http_login_password=dict(type='str', required=False, default=None, no_log=True),
validate_certs=dict(type='bool', required=False, default=True), validate_certs=dict(type='bool', required=False, default=True),
host_groups=dict(type='list', required=True, aliases=['host_group']), 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) timeout=dict(type='int', default=10)
), ),
supports_check_mode=True supports_check_mode=True

View file

@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
RETURN = ''' RETURN = r'''
--- ---
host_groups: host_groups:
description: List of Zabbix groups. description: List of Zabbix groups.
@ -21,7 +21,7 @@ host_groups:
sample: [ { "flags": "0", "groupid": "33", "internal": "0", "name": "Hostgruup A" } ] sample: [ { "flags": "0", "groupid": "33", "internal": "0", "name": "Hostgruup A" } ]
''' '''
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_group_info module: zabbix_group_info
short_description: Gather information about Zabbix hostgroup short_description: Gather information about Zabbix hostgroup
@ -40,11 +40,13 @@ options:
- Name of the hostgroup in Zabbix. - Name of the hostgroup in Zabbix.
- hostgroup is the unique identifier used and cannot be updated using this module. - hostgroup is the unique identifier used and cannot be updated using this module.
required: true required: true
type: list
elements: str
extends_documentation_fragment: extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Get hostgroup info - name: Get hostgroup info
local_action: local_action:
module: zabbix_group_info module: zabbix_group_info

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_host module: zabbix_host
short_description: Create/update/delete Zabbix hosts short_description: Create/update/delete Zabbix hosts
@ -35,36 +35,46 @@ options:
- Name of the host in Zabbix. - Name of the host in Zabbix.
- I(host_name) is the unique identifier used and cannot be updated using this module. - I(host_name) is the unique identifier used and cannot be updated using this module.
required: true required: true
type: str
visible_name: visible_name:
description: description:
- Visible name of the host in Zabbix. - Visible name of the host in Zabbix.
version_added: '2.3' version_added: '2.3'
type: str
description: description:
description: description:
- Description of the host in Zabbix. - Description of the host in Zabbix.
version_added: '2.5' version_added: '2.5'
type: str
host_groups: host_groups:
description: description:
- List of host groups the host is part of. - List of host groups the host is part of.
type: list
elements: str
link_templates: link_templates:
description: description:
- List of templates linked to the host. - List of templates linked to the host.
type: list
elements: str
inventory_mode: inventory_mode:
description: description:
- Configure the inventory mode. - Configure the inventory mode.
choices: ['automatic', 'manual', 'disabled'] choices: ['automatic', 'manual', 'disabled']
version_added: '2.1' version_added: '2.1'
type: str
inventory_zabbix: inventory_zabbix:
description: description:
- Add Facts for a zabbix inventory (e.g. Tag) (see example below). - Add Facts for a zabbix inventory (e.g. Tag) (see example below).
- Please review the interface documentation for more information on the supported properties - 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) - U(https://www.zabbix.com/documentation/3.2/manual/api/reference/host/object#host_inventory)
version_added: '2.5' version_added: '2.5'
type: dict
status: status:
description: description:
- Monitoring status of the host. - Monitoring status of the host.
choices: ['enabled', 'disabled'] choices: ['enabled', 'disabled']
default: 'enabled' default: 'enabled'
type: str
state: state:
description: description:
- State of the host. - State of the host.
@ -72,11 +82,14 @@ options:
- On C(absent) will remove a host if it exists. - On C(absent) will remove a host if it exists.
choices: ['present', 'absent'] choices: ['present', 'absent']
default: 'present' default: 'present'
type: str
proxy: proxy:
description: description:
- The name of the Zabbix proxy to be used. - The name of the Zabbix proxy to be used.
type: str
interfaces: interfaces:
type: list type: list
elements: dict
description: description:
- List of interfaces to be created for the host (see example below). - List of interfaces to be created for the host (see example below).
- For more information, review host interface documentation at - For more information, review host interface documentation at
@ -143,6 +156,7 @@ options:
- Works only with >= Zabbix 3.0 - Works only with >= Zabbix 3.0
default: 1 default: 1
version_added: '2.5' version_added: '2.5'
type: int
tls_accept: tls_accept:
description: description:
- Specifies what types of connections are allowed for incoming connections. - Specifies what types of connections are allowed for incoming connections.
@ -152,29 +166,34 @@ options:
- Works only with >= Zabbix 3.0 - Works only with >= Zabbix 3.0
default: 1 default: 1
version_added: '2.5' version_added: '2.5'
type: int
tls_psk_identity: tls_psk_identity:
description: description:
- It is a unique name by which this specific PSK is referred to by Zabbix components - 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. - Do not put sensitive information in the PSK identity string, it is transmitted over the network unencrypted.
- Works only with >= Zabbix 3.0 - Works only with >= Zabbix 3.0
version_added: '2.5' version_added: '2.5'
type: str
tls_psk: tls_psk:
description: description:
- PSK value is a hard to guess string of hexadecimal digits. - 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. - 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 - Works only with >= Zabbix 3.0
version_added: '2.5' version_added: '2.5'
type: str
ca_cert: ca_cert:
description: description:
- Required certificate issuer. - Required certificate issuer.
- Works only with >= Zabbix 3.0 - Works only with >= Zabbix 3.0
version_added: '2.5' version_added: '2.5'
aliases: [ tls_issuer ] aliases: [ tls_issuer ]
type: str
tls_subject: tls_subject:
description: description:
- Required certificate subject. - Required certificate subject.
- Works only with >= Zabbix 3.0 - Works only with >= Zabbix 3.0
version_added: '2.5' version_added: '2.5'
type: str
ipmi_authtype: ipmi_authtype:
description: description:
- IPMI authentication algorithm. - 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 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. options individually, the rest will be reset to default values.
version_added: '2.5' version_added: '2.5'
type: int
ipmi_privilege: ipmi_privilege:
description: description:
- IPMI privilege level. - IPMI privilege level.
@ -195,16 +215,19 @@ options:
being the API default. being the API default.
- also see the last note in the I(ipmi_authtype) documentation - also see the last note in the I(ipmi_authtype) documentation
version_added: '2.5' version_added: '2.5'
type: int
ipmi_username: ipmi_username:
description: description:
- IPMI username. - IPMI username.
- also see the last note in the I(ipmi_authtype) documentation - also see the last note in the I(ipmi_authtype) documentation
version_added: '2.5' version_added: '2.5'
type: str
ipmi_password: ipmi_password:
description: description:
- IPMI password. - IPMI password.
- also see the last note in the I(ipmi_authtype) documentation - also see the last note in the I(ipmi_authtype) documentation
version_added: '2.5' version_added: '2.5'
type: str
force: force:
description: description:
- Overwrite the host configuration, even if already present. - Overwrite the host configuration, even if already present.
@ -215,7 +238,7 @@ extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create a new host or update an existing host's info - name: Create a new host or update an existing host's info
local_action: local_action:
module: zabbix_host module: zabbix_host
@ -671,9 +694,9 @@ def main():
validate_certs=dict(type='bool', required=False, default=True), validate_certs=dict(type='bool', required=False, default=True),
host_groups=dict(type='list', required=False), host_groups=dict(type='list', required=False),
link_templates=dict(type='list', required=False), link_templates=dict(type='list', required=False),
status=dict(default="enabled", choices=['enabled', 'disabled']), status=dict(type='str', default="enabled", choices=['enabled', 'disabled']),
state=dict(default="present", choices=['present', 'absent']), state=dict(type='str', default="present", choices=['present', 'absent']),
inventory_mode=dict(required=False, choices=['automatic', 'manual', 'disabled']), inventory_mode=dict(type='str', required=False, choices=['automatic', 'manual', 'disabled']),
ipmi_authtype=dict(type='int', default=None), ipmi_authtype=dict(type='int', default=None),
ipmi_privilege=dict(type='int', default=None), ipmi_privilege=dict(type='int', default=None),
ipmi_username=dict(type='str', required=False, default=None), ipmi_username=dict(type='str', required=False, default=None),
@ -684,7 +707,7 @@ def main():
tls_psk=dict(type='str', required=False), tls_psk=dict(type='str', required=False),
ca_cert=dict(type='str', required=False, aliases=['tls_issuer']), ca_cert=dict(type='str', required=False, aliases=['tls_issuer']),
tls_subject=dict(type='str', required=False), 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), timeout=dict(type='int', default=10),
interfaces=dict(type='list', required=False), interfaces=dict(type='list', required=False),
force=dict(type='bool', default=True), force=dict(type='bool', default=True),

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
RETURN = ''' RETURN = r'''
--- ---
hosts: hosts:
description: List of Zabbix hosts. See https://www.zabbix.com/documentation/4.0/manual/api/reference/host/get for list of host values. 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", ... } ] sample: [ { "available": "1", "description": "", "disable_until": "0", "error": "", "flags": "0", "groups": ["1"], "host": "Host A", ... } ]
''' '''
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_host_info module: zabbix_host_info
short_description: Gather information about Zabbix host short_description: Gather information about Zabbix host
@ -40,11 +40,16 @@ options:
description: description:
- Name of the host in Zabbix. - Name of the host in Zabbix.
- host_name is the unique identifier used and cannot be updated using this module. - 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: host_ip:
description: description:
- Host interface IP of the host in Zabbix. - Host interface IP of the host in Zabbix.
- Required when I(host_name) is not used.
required: false required: false
type: list
elements: str
exact_match: exact_match:
description: description:
- Find the exact match - Find the exact match
@ -60,13 +65,14 @@ options:
- List of host inventory keys to display in result. - List of host inventory keys to display in result.
- Whole host inventory is retrieved if keys are not specified. - Whole host inventory is retrieved if keys are not specified.
type: list type: list
elements: str
required: false required: false
version_added: 2.8 version_added: 2.8
extends_documentation_fragment: extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Get host info - name: Get host info
local_action: local_action:
module: zabbix_host_info module: zabbix_host_info

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_hostmacro module: zabbix_hostmacro
short_description: Create/update/delete Zabbix host macros short_description: Create/update/delete Zabbix host macros
@ -31,14 +31,17 @@ options:
description: description:
- Name of the host. - Name of the host.
required: true required: true
type: str
macro_name: macro_name:
description: description:
- Name of the host macro in zabbix native format C({$MACRO}) or simple format C(MACRO). - Name of the host macro in zabbix native format C({$MACRO}) or simple format C(MACRO).
required: true required: true
type: str
macro_value: macro_value:
description: description:
- Value of the host macro. - Value of the host macro.
- Required if I(state=present). - Required if I(state=present).
type: str
state: state:
description: description:
- State of the macro. - State of the macro.
@ -46,6 +49,7 @@ options:
- On C(absent) will remove a macro if it exists. - On C(absent) will remove a macro if it exists.
required: false required: false
choices: ['present', 'absent'] choices: ['present', 'absent']
type: str
default: "present" default: "present"
force: force:
description: description:
@ -58,7 +62,7 @@ extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create new host macro or update an existing macro's value - name: Create new host macro or update an existing macro's value
local_action: local_action:
module: zabbix_hostmacro module: zabbix_hostmacro
@ -198,7 +202,7 @@ def main():
host_name=dict(type='str', required=True), host_name=dict(type='str', required=True),
macro_name=dict(type='str', required=True), macro_name=dict(type='str', required=True),
macro_value=dict(type='str', required=False), 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), timeout=dict(type='int', default=10),
force=dict(type='bool', default=True) force=dict(type='bool', default=True)
), ),

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
module: zabbix_maintenance module: zabbix_maintenance
short_description: Create Zabbix maintenance windows 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. - Create or remove a maintenance window. Maintenance window to remove is identified by name.
default: present default: present
choices: [ "present", "absent" ] choices: [ "present", "absent" ]
type: str
host_names: host_names:
description: description:
- Hosts to manage maintenance window for. - Hosts to manage maintenance window for.
Separate multiple hosts with commas. - B(Required) option when I(state=present) and I(host_groups) is not used.
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.
aliases: [ "host_name" ] aliases: [ "host_name" ]
type: list
elements: str
host_groups: host_groups:
description: description:
- Host groups to manage maintenance window for. - Host groups to manage maintenance window for.
Separate multiple groups with commas. - B(Required) option when I(state=present) and I(host_names) is not used.
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.
aliases: [ "host_group" ] aliases: [ "host_group" ]
type: list
elements: str
minutes: minutes:
description: description:
- Length of maintenance window in minutes. - Length of maintenance window in minutes.
default: 10 default: 10
type: int
name: name:
description: description:
- Unique name of maintenance window. - Unique name of maintenance window.
required: true required: true
type: str
desc: desc:
description: description:
- Short description of maintenance window. - Short description of maintenance window.
required: true
default: Created by Ansible default: Created by Ansible
type: str
collect_data: collect_data:
description: description:
- Type of maintenance. With data collection, or without. - Type of maintenance. With data collection, or without.
@ -77,7 +78,7 @@ notes:
- Install required module with 'pip install zabbix-api' command. - Install required module with 'pip install zabbix-api' command.
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create a named maintenance window for host www1 for 90 minutes - name: Create a named maintenance window for host www1 for 90 minutes
zabbix_maintenance: zabbix_maintenance:
name: Update of www1 name: Update of www1
@ -273,8 +274,8 @@ def get_host_ids(zbx, host_names):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
state=dict(required=False, default='present', choices=['present', 'absent']), state=dict(type='str', required=False, default='present', choices=['present', 'absent']),
server_url=dict(type='str', required=True, default=None, aliases=['url']), server_url=dict(type='str', required=True, aliases=['url']),
host_names=dict(type='list', required=False, default=None, aliases=['host_name']), host_names=dict(type='list', required=False, default=None, aliases=['host_name']),
minutes=dict(type='int', required=False, default=10), minutes=dict(type='int', required=False, default=10),
host_groups=dict(type='list', required=False, default=None, aliases=['host_group']), host_groups=dict(type='list', required=False, default=None, aliases=['host_group']),
@ -362,7 +363,7 @@ def main():
if module.check_mode: if module.check_mode:
changed = True changed = True
else: 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: if rc == 0:
changed = True changed = True
else: else:
@ -372,7 +373,7 @@ def main():
if module.check_mode: if module.check_mode:
changed = True changed = True
else: 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: if rc == 0:
changed = True changed = True
else: else:
@ -388,7 +389,7 @@ def main():
if module.check_mode: if module.check_mode:
changed = True changed = True
else: else:
(rc, _, error) = delete_maintenance(zbx, maintenance["maintenanceid"]) (rc, data, error) = delete_maintenance(zbx, maintenance["maintenanceid"])
if rc == 0: if rc == 0:
changed = True changed = True
else: else:

View file

@ -7,7 +7,7 @@
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_map module: zabbix_map
author: author:
@ -50,11 +50,13 @@ options:
- Name of the map. - Name of the map.
required: true required: true
aliases: [ "map_name" ] aliases: [ "map_name" ]
type: str
data: data:
description: description:
- Graph written in DOT language. - Graph written in DOT language.
required: false required: false
aliases: [ "dot_data" ] aliases: [ "dot_data" ]
type: str
state: state:
description: description:
- State of the map. - State of the map.
@ -63,21 +65,25 @@ options:
required: false required: false
choices: ['present', 'absent'] choices: ['present', 'absent']
default: "present" default: "present"
type: str
width: width:
description: description:
- Width of the map. - Width of the map.
required: false required: false
default: 800 default: 800
type: int
height: height:
description: description:
- Height of the map. - Height of the map.
required: false required: false
default: 600 default: 600
type: int
margin: margin:
description: description:
- Size of white space between map's borders and its elements. - Size of white space between map's borders and its elements.
required: false required: false
default: 40 default: 40
type: int
expand_problem: expand_problem:
description: description:
- Whether the problem trigger will be displayed for elements with a single problem. - Whether the problem trigger will be displayed for elements with a single problem.
@ -96,19 +102,21 @@ options:
required: false required: false
choices: ['label', 'ip', 'name', 'status', 'nothing', 'custom'] choices: ['label', 'ip', 'name', 'status', 'nothing', 'custom']
default: "name" default: "name"
type: str
default_image: default_image:
description: description:
- Name of the Zabbix image used to display the element if this element doesn't have the C(zbx_image) attribute defined. - Name of the Zabbix image used to display the element if this element doesn't have the C(zbx_image) attribute defined.
required: false required: false
aliases: [ "image" ] aliases: [ "image" ]
type: str
extends_documentation_fragment: extends_documentation_fragment:
- zabbix - zabbix
''' '''
RETURN = ''' # ''' RETURN = r''' # '''
EXAMPLES = ''' EXAMPLES = r'''
### ###
### Example inventory: ### Example inventory:
# [web] # [web]
@ -758,7 +766,7 @@ def main():
data=dict(type='str', required=False, aliases=['dot_data']), data=dict(type='str', required=False, aliases=['dot_data']),
width=dict(type='int', default=800), width=dict(type='int', default=800),
height=dict(type='int', default=600), 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']), default_image=dict(type='str', required=False, aliases=['image']),
margin=dict(type='int', default=40), margin=dict(type='int', default=40),
expand_problem=dict(type='bool', default=True), expand_problem=dict(type='bool', default=True),

View file

@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_mediatype module: zabbix_mediatype
short_description: Create/Update/Delete Zabbix media types short_description: Create/Update/Delete Zabbix media types
@ -40,7 +40,6 @@ options:
- present - present
- absent - absent
default: 'present' default: 'present'
required: true
type: type:
type: 'str' type: 'str'
description: description:
@ -85,6 +84,7 @@ options:
- Required when I(type=script). - Required when I(type=script).
script_params: script_params:
type: 'list' type: 'list'
elements: str
description: description:
- List of script parameters. - List of script parameters.
- Required when I(type=script). - 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' - name: 'Create an email mediatype with SMTP authentication'
zabbix_mediatype: zabbix_mediatype:
name: "Ops email" name: "Ops email"

View file

@ -25,7 +25,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_proxy module: zabbix_proxy
short_description: Create/delete/get/update Zabbix proxies short_description: Create/delete/get/update Zabbix proxies
@ -42,6 +42,7 @@ options:
description: description:
- Name of the proxy in Zabbix. - Name of the proxy in Zabbix.
required: true required: true
type: str
proxy_address: proxy_address:
description: description:
- Comma-delimited list of IP/CIDR addresses or DNS names to accept active proxy requests from. - 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 ) - Works only with >= Zabbix 4.0. ( remove option for <= 4.0 )
required: false required: false
version_added: '2.10' version_added: '2.10'
type: str
description: description:
description: description:
- Description of the proxy. - Description of the proxy.
required: false required: false
type: str
status: status:
description: description:
- Type of proxy. (4 - active, 5 - passive) - Type of proxy. (4 - active, 5 - passive)
required: false required: false
choices: ['active', 'passive'] choices: ['active', 'passive']
default: "active" default: "active"
type: str
tls_connect: tls_connect:
description: description:
- Connections to proxy. - Connections to proxy.
required: false required: false
choices: ['no_encryption','PSK','certificate'] choices: ['no_encryption','PSK','certificate']
default: 'no_encryption' default: 'no_encryption'
type: str
tls_accept: tls_accept:
description: description:
- Connections from proxy. - Connections from proxy.
required: false required: false
choices: ['no_encryption','PSK','certificate'] choices: ['no_encryption','PSK','certificate']
default: 'no_encryption' default: 'no_encryption'
type: str
ca_cert: ca_cert:
description: description:
- Certificate issuer. - Certificate issuer.
required: false required: false
aliases: [ tls_issuer ] aliases: [ tls_issuer ]
type: str
tls_subject: tls_subject:
description: description:
- Certificate subject. - Certificate subject.
required: false required: false
type: str
tls_psk_identity: tls_psk_identity:
description: description:
- PSK identity. Required if either I(tls_connect) or I(tls_accept) has PSK enabled. - PSK identity. Required if either I(tls_connect) or I(tls_accept) has PSK enabled.
required: false required: false
type: str
tls_psk: tls_psk:
description: description:
- The preshared key, at least 32 hex digits. Required if either I(tls_connect) or I(tls_accept) has PSK enabled. - The preshared key, at least 32 hex digits. Required if either I(tls_connect) or I(tls_accept) has PSK enabled.
required: false required: false
type: str
state: state:
description: description:
- State of the proxy. - State of the proxy.
@ -96,6 +106,7 @@ options:
required: false required: false
choices: ['present', 'absent'] choices: ['present', 'absent']
default: "present" default: "present"
type: str
interface: interface:
description: description:
- Dictionary with params for the interface when proxy is in passive mode - 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) - U(https://www.zabbix.com/documentation/3.2/manual/api/reference/proxy/object#proxy_interface)
required: false required: false
default: {} default: {}
type: dict
extends_documentation_fragment: extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create a new proxy or update an existing proxy - name: Create a new proxy or update an existing proxy
local_action: local_action:
module: zabbix_proxy module: zabbix_proxy
@ -130,7 +142,7 @@ EXAMPLES = '''
port: 10050 port: 10050
''' '''
RETURN = ''' # ''' RETURN = r''' # '''
import traceback import traceback
@ -267,12 +279,12 @@ def main():
http_login_password=dict(type='str', required=False, http_login_password=dict(type='str', required=False,
default=None, no_log=True), default=None, no_log=True),
validate_certs=dict(type='bool', required=False, default=True), validate_certs=dict(type='bool', required=False, default=True),
status=dict(default="active", choices=['active', 'passive']), status=dict(type='str', default="active", choices=['active', 'passive']),
state=dict(default="present", choices=['present', 'absent']), state=dict(type='str', default="present", choices=['present', 'absent']),
description=dict(type='str', required=False), 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']), choices=['no_encryption', 'PSK', 'certificate']),
tls_accept=dict(default='no_encryption', tls_accept=dict(type='str', default='no_encryption',
choices=['no_encryption', 'PSK', 'certificate']), choices=['no_encryption', 'PSK', 'certificate']),
ca_cert=dict(type='str', required=False, default=None, aliases=['tls_issuer']), ca_cert=dict(type='str', required=False, default=None, aliases=['tls_issuer']),
tls_subject=dict(type='str', required=False, default=None), tls_subject=dict(type='str', required=False, default=None),

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_screen module: zabbix_screen
short_description: Create/update/delete Zabbix screens short_description: Create/update/delete Zabbix screens
@ -32,6 +32,7 @@ options:
description: description:
- List of screens to be created/updated/deleted (see example). - List of screens to be created/updated/deleted (see example).
type: list type: list
elements: dict
required: true required: true
suboptions: suboptions:
screen_name: screen_name:
@ -39,13 +40,12 @@ options:
- Screen name will be used. - Screen name will be used.
- If a screen has already been added, the screen name won't be updated. - If a screen has already been added, the screen name won't be updated.
type: str type: str
required: yes required: true
host_group: host_group:
description: description:
- Host group will be used for searching hosts. - Host group will be used for searching hosts.
- Required if I(state=present). - Required if I(state=present).
type: str type: str
required: yes
state: state:
description: description:
- I(present) - Create a screen if it doesn't exist. If the screen already exists, the screen will be updated as needed. - 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. - Graph names will be added to a screen. Case insensitive.
- Required if I(state=present). - Required if I(state=present).
type: list type: list
elements: str
graph_width: graph_width:
description: description:
- Graph width will be set in graph settings. - 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. - 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. # Create/update a screen.
- name: Create a new screen or update an existing screen's items 5 in a row - name: Create a new screen or update an existing screen's items 5 in a row
local_action: local_action:
@ -350,16 +351,24 @@ def main():
http_login_password=dict(type='str', required=False, default=None, no_log=True), http_login_password=dict(type='str', required=False, default=None, no_log=True),
validate_certs=dict(type='bool', required=False, default=True), validate_certs=dict(type='bool', required=False, default=True),
timeout=dict(type='int', default=10), timeout=dict(type='int', default=10),
screens=dict(type='list', elements='dict', required=True, options=dict( screens=dict(
screen_name=dict(type='str', required=True), type='list',
host_group=dict(type='str'), elements='dict',
state=dict(type='str', default='present', choices=['absent', 'present']), required=True,
graph_names=dict(type='list', elements='str'), options=dict(
graph_width=dict(type='int', default=None), screen_name=dict(type='str', required=True),
graph_height=dict(type='int', default=None), host_group=dict(type='str'),
graphs_in_row=dict(type='int', default=3), state=dict(type='str', default='present', choices=['absent', 'present']),
sort=dict(default=False, type='bool'), 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 supports_check_mode=True
) )

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_template module: zabbix_template
short_description: Create/update/delete/dump 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. - Required when I(template_json) or I(template_xml) are not used.
- Mutually exclusive with I(template_json) and I(template_xml). - Mutually exclusive with I(template_json) and I(template_xml).
required: false required: false
type: str
template_json: template_json:
description: description:
- JSON dump of templates to import. - JSON dump of templates to import.
@ -52,6 +53,7 @@ options:
- Mutually exclusive with I(template_name) and I(template_json). - Mutually exclusive with I(template_name) and I(template_json).
required: false required: false
version_added: '2.9' version_added: '2.9'
type: str
template_groups: template_groups:
description: description:
- List of host groups to add template to when template is created. - List of host groups to add template to when template is created.
@ -60,6 +62,7 @@ options:
Not required when updating an existing template. Not required when updating an existing template.
required: false required: false
type: list type: list
elements: str
link_templates: link_templates:
description: description:
- List of template names to be linked to the template. - List of template names to be linked to the template.
@ -67,12 +70,14 @@ options:
cleared from the template. cleared from the template.
required: false required: false
type: list type: list
elements: str
clear_templates: clear_templates:
description: description:
- List of template names to be unlinked and cleared from the template. - 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. - This option is ignored if template is being created for the first time.
required: false required: false
type: list type: list
elements: str
macros: macros:
description: description:
- List of user macros to create for the template. - List of user macros to create for the template.
@ -80,14 +85,17 @@ options:
- See examples on how to pass macros. - See examples on how to pass macros.
required: false required: false
type: list type: list
elements: dict
suboptions: suboptions:
name: name:
description: description:
- Name of the macro. - Name of the macro.
- Must be specified in {$NAME} format. - Must be specified in {$NAME} format.
type: str
value: value:
description: description:
- Value of the macro. - Value of the macro.
type: str
dump_format: dump_format:
description: description:
- Format to use when dumping template with C(state=dump). - Format to use when dumping template with C(state=dump).
@ -96,6 +104,7 @@ options:
choices: [json, xml] choices: [json, xml]
default: "json" default: "json"
version_added: '2.9' version_added: '2.9'
type: str
state: state:
description: description:
- Required state of the template. - Required state of the template.
@ -106,12 +115,13 @@ options:
required: false required: false
choices: [present, absent, dump] choices: [present, absent, dump]
default: "present" default: "present"
type: str
extends_documentation_fragment: extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
--- ---
- name: Create a new Zabbix template linked to groups, macros and templates - name: Create a new Zabbix template linked to groups, macros and templates
local_action: local_action:
@ -226,7 +236,7 @@ EXAMPLES = '''
register: template_dump register: template_dump
''' '''
RETURN = ''' RETURN = r'''
--- ---
template_json: template_json:
description: The JSON dump of the template description: The JSON dump of the template
@ -611,7 +621,7 @@ def main():
clear_templates=dict(type='list', required=False), clear_templates=dict(type='list', required=False),
macros=dict(type='list', required=False), macros=dict(type='list', required=False),
dump_format=dict(type='str', required=False, default='json', choices=['json', 'xml']), 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) timeout=dict(type='int', default=10)
), ),
required_one_of=[ required_one_of=[

View file

@ -12,7 +12,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
module: zabbix_user module: zabbix_user
short_description: Create/update/delete Zabbix users short_description: Create/update/delete Zabbix users
author: author:
@ -43,7 +43,9 @@ options:
usrgrps: usrgrps:
description: description:
- User groups to add the user to. - User groups to add the user to.
required: true
type: list type: list
elements: str
passwd: passwd:
description: description:
- User's password. - User's password.
@ -183,6 +185,7 @@ options:
default: true default: true
type: bool type: bool
type: list type: list
elements: dict
type: type:
description: description:
- Type of the user. - Type of the user.
@ -204,7 +207,7 @@ extends_documentation_fragment:
- zabbix - zabbix
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: create of zabbix user. - name: create of zabbix user.
zabbix_user: zabbix_user:
server_url: "http://zabbix.example.com/zabbix/" server_url: "http://zabbix.example.com/zabbix/"
@ -253,7 +256,7 @@ EXAMPLES = '''
state: absent state: absent
''' '''
RETURN = ''' RETURN = r'''
user_ids: user_ids:
description: User id created or changed description: User id created or changed
returned: success returned: success

View file

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1',
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = r'''
--- ---
module: zabbix_valuemap module: zabbix_valuemap
short_description: Create/update/delete Zabbix value maps short_description: Create/update/delete Zabbix value maps
@ -40,9 +40,10 @@ options:
default: 'present' default: 'present'
mappings: mappings:
type: 'list' type: 'list'
elements: dict
description: description:
- List of value mappings for the value map. - List of value mappings for the value map.
required: true - Required when I(state=present).
suboptions: suboptions:
value: value:
type: 'str' type: 'str'
@ -57,10 +58,10 @@ extends_documentation_fragment:
- zabbix - zabbix
''' '''
RETURN = ''' RETURN = r'''
''' '''
EXAMPLES = ''' EXAMPLES = r'''
- name: Create a value map - name: Create a value map
local_action: local_action:
module: zabbix_valuemap module: zabbix_valuemap

View file

@ -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: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:parameter-type-not-in-doc
lib/ansible/modules/monitoring/zabbix/zabbix_action.py validate-modules:undocumented-parameter 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/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 pylint:blacklisted-name
lib/ansible/modules/net_tools/basics/uri.py validate-modules:doc-required-mismatch lib/ansible/modules/net_tools/basics/uri.py validate-modules:doc-required-mismatch