Merge pull request #533 from resmo/fix/zabbix

zabbix: improve arguments and update doc
This commit is contained in:
Brian Coca 2015-05-26 09:56:55 -04:00
commit 539553d737
4 changed files with 30 additions and 30 deletions

View file

@ -63,13 +63,17 @@ options:
default: None default: None
status: status:
description: description:
- 'Monitoring status of the host. Possible values are: "enabled" and "disabled".' - 'Monitoring status of the host.
required: false required: false
choices: ['enabled', 'disabled']
default: "enabled" default: "enabled"
state: state:
description: description:
- 'Possible values are: "present" and "absent". If the host already exists, and the state is "present", it will just to update the host is the associated data is different. "absent" will remove a host if it exists.' - State of the host.
- On C(present), it will create if host does not exist or update the host if the associated data is different.
- On C(absent) will remove a host if it exists.
required: false required: false
choices: ['present', 'absent']
default: "present" default: "present"
timeout: timeout:
description: description:
@ -80,7 +84,7 @@ options:
- List of interfaces to be created for the host (see example below). - List of interfaces to be created for the host (see example below).
- 'Available values are: dns, ip, main, port, type and useip.' - 'Available values are: dns, ip, main, port, type and useip.'
- Please review the interface documentation for more information on the supported properties - Please review the interface documentation for more information on the supported properties
- https://www.zabbix.com/documentation/2.0/manual/appendix/api/hostinterface/definitions#host_interface - 'https://www.zabbix.com/documentation/2.0/manual/appendix/api/hostinterface/definitions#host_interface'
required: false required: false
default: [] default: []
''' '''
@ -118,7 +122,6 @@ EXAMPLES = '''
import logging import logging
import copy import copy
from ansible.module_utils.basic import *
try: try:
from zabbix_api import ZabbixAPI, ZabbixAPISubClass from zabbix_api import ZabbixAPI, ZabbixAPISubClass
@ -339,13 +342,13 @@ def main():
argument_spec=dict( argument_spec=dict(
server_url=dict(required=True, aliases=['url']), server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True), login_user=dict(required=True),
login_password=dict(required=True), login_password=dict(required=True, no_log=True),
host_name=dict(required=True), host_name=dict(required=True),
host_groups=dict(required=False), host_groups=dict(required=False),
link_templates=dict(required=False), link_templates=dict(required=False),
status=dict(default="enabled"), status=dict(default="enabled", choices=['enabled', 'disabled']),
state=dict(default="present"), state=dict(default="present", choices=['present', 'absent']),
timeout=dict(default=10), timeout=dict(type='int', default=10),
interfaces=dict(required=False) interfaces=dict(required=False)
), ),
supports_check_mode=True supports_check_mode=True

View file

@ -60,8 +60,11 @@ options:
required: true required: true
state: state:
description: description:
- 'Possible values are: "present" and "absent". If the macro already exists, and the state is "present", it will just to update the macro if needed.' - State of the macro.
- On C(present), it will create if macro does not exist or update the macro if the associated data is different.
- On C(absent) will remove a macro if it exists.
required: false required: false
choices: ['present', 'absent']
default: "present" default: "present"
timeout: timeout:
description: description:
@ -84,7 +87,6 @@ EXAMPLES = '''
import logging import logging
import copy import copy
from ansible.module_utils.basic import *
try: try:
from zabbix_api import ZabbixAPI, ZabbixAPISubClass from zabbix_api import ZabbixAPI, ZabbixAPISubClass
@ -171,12 +173,12 @@ def main():
argument_spec=dict( argument_spec=dict(
server_url=dict(required=True, aliases=['url']), server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True), login_user=dict(required=True),
login_password=dict(required=True), login_password=dict(required=True, no_log=True),
host_name=dict(required=True), host_name=dict(required=True),
macro_name=dict(required=True), macro_name=dict(required=True),
macro_value=dict(required=True), macro_value=dict(required=True),
state=dict(default="present"), state=dict(default="present", choices=['present', 'absent']),
timeout=dict(default=10) timeout=dict(type='int', default=10)
), ),
supports_check_mode=True supports_check_mode=True
) )

View file

@ -48,12 +48,10 @@ options:
description: description:
- Zabbix user name. - Zabbix user name.
required: true required: true
default: null
login_password: login_password:
description: description:
- Zabbix user password. - Zabbix user password.
required: true required: true
default: null
host_names: host_names:
description: description:
- Hosts to manage maintenance window for. - Hosts to manage maintenance window for.
@ -83,7 +81,6 @@ options:
description: description:
- Unique name of maintenance window. - Unique name of maintenance window.
required: true required: true
default: null
desc: desc:
description: description:
- Short description of maintenance window. - Short description of maintenance window.
@ -273,9 +270,9 @@ def main():
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']),
login_user=dict(required=True, default=None), login_user=dict(required=True),
login_password=dict(required=True, default=None), login_password=dict(required=True, no_log=True),
name=dict(required=True, default=None), name=dict(required=True),
desc=dict(required=False, default="Created by Ansible"), desc=dict(required=False, default="Created by Ansible"),
collect_data=dict(type='bool', required=False, default=True), collect_data=dict(type='bool', required=False, default=True),
), ),

View file

@ -56,9 +56,9 @@ options:
description: description:
- List of screens to be created/updated/deleted(see example). - List of screens to be created/updated/deleted(see example).
- If the screen(s) already been added, the screen(s) name won't be updated. - If the screen(s) already been added, the screen(s) name won't be updated.
- When creating or updating screen(s), the screen_name, host_group are required. - When creating or updating screen(s), C(screen_name), C(host_group) are required.
- When deleting screen(s), the screen_name is required. - When deleting screen(s), the C(screen_name) is required.
- 'The available states are: present(default) and absent. If the screen(s) already exists, and the state is not "absent", the screen(s) will just be updated as needed.' - 'The available states are: C(present) (default) and C(absent). If the screen(s) already exists, and the state is not C(absent), the screen(s) will just be updated as needed.'
required: true required: true
notes: 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.
@ -127,8 +127,6 @@ EXAMPLES = '''
when: inventory_hostname==groups['group_name'][0] when: inventory_hostname==groups['group_name'][0]
''' '''
from ansible.module_utils.basic import *
try: try:
from zabbix_api import ZabbixAPI, ZabbixAPISubClass from zabbix_api import ZabbixAPI, ZabbixAPISubClass
from zabbix_api import ZabbixAPIException from zabbix_api import ZabbixAPIException
@ -319,9 +317,9 @@ def main():
argument_spec=dict( argument_spec=dict(
server_url=dict(required=True, aliases=['url']), server_url=dict(required=True, aliases=['url']),
login_user=dict(required=True), login_user=dict(required=True),
login_password=dict(required=True), login_password=dict(required=True, no_log=True),
timeout=dict(default=10), timeout=dict(type='int', default=10),
screens=dict(required=True) screens=dict(type='dict', required=True)
), ),
supports_check_mode=True supports_check_mode=True
) )