Updated documentation for zabbix-screen module (#57325)

Updated module settings.
Do not check screens options because of module screens.
pull/57549/head
Mikhail Naletov 5 years ago committed by Felix Fontein
parent 07d446825a
commit fba67bbe53

@ -0,0 +1,2 @@
minor_changes:
- "zabbix_screen - updated documentation and module arguments"

@ -31,15 +31,56 @@ options:
screens:
description:
- List of screens to be created/updated/deleted (see example).
- If a screen has already been added, the screen name won't be updated.
- When creating or updating a screen, C(screen_name) and C(host_group) are required.
- When deleting a screen, the C(screen_name) is required.
- Option C(graphs_in_row) will limit columns of a screen and make multiple rows (default 3).
- >
The available states are: C(present) (default) and C(absent). If the screen already exists, and the state is not C(absent), the screen
will be updated as needed.
- To sort hosts alphabetically, set the C(sort) option to C(true)
type: list
required: true
suboptions:
screen_name:
description:
- Screen name will be used.
- If a screen has already been added, the screen name won't be updated.
type: str
required: yes
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.
- I(absent) - If a screen exists, the screen will be deleted.
type: str
default: present
choices:
- absent
- present
graph_names:
description:
- Graph names will be added to a screen. Case insensitive.
- Required if I(state=present).
type: list
graph_width:
description:
- Graph width will be set in graph settings.
type: int
default: None
graph_height:
description:
- Graph height will be set in graph settings.
type: int
default: None
graphs_in_row:
description:
- Limit columns of a screen and make multiple rows.
type: int
default: 3
sort:
description:
- Sort hosts alphabetically.
- If there are numbers in hostnames, leading zero should be used.
type: bool
default: no
extends_documentation_fragment:
- zabbix
@ -316,7 +357,16 @@ 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', required=True)
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'),
))
),
supports_check_mode=True
)
@ -350,8 +400,8 @@ def main():
for zabbix_screen in screens:
screen_name = zabbix_screen['screen_name']
screen_id = screen.get_screen_id(screen_name)
state = "absent" if "state" in zabbix_screen and zabbix_screen['state'] == "absent" else "present"
sort = bool(zabbix_screen.get("sort", False))
state = zabbix_screen['state']
sort = zabbix_screen['sort']
if state == "absent":
if screen_id:
@ -367,15 +417,9 @@ def main():
else:
host_group = zabbix_screen['host_group']
graph_names = zabbix_screen['graph_names']
graphs_in_row = 3
if 'graphs_in_row' in zabbix_screen:
graphs_in_row = zabbix_screen['graphs_in_row']
graph_width = None
if 'graph_width' in zabbix_screen:
graph_width = zabbix_screen['graph_width']
graph_height = None
if 'graph_height' in zabbix_screen:
graph_height = zabbix_screen['graph_height']
graphs_in_row = zabbix_screen['graphs_in_row']
graph_width = zabbix_screen['graph_width']
graph_height = zabbix_screen['graph_height']
host_group_id = screen.get_host_group_id(host_group)
hosts = screen.get_host_ids_by_group_id(host_group_id, sort)

Loading…
Cancel
Save