New in version 2.8.
zbx_host contains name of the host in Zabbix. Use this if desired type of map element is host. zbx_group contains name of the host group in Zabbix. Use this if desired type of map element is host group. zbx_map contains name of the map in Zabbix. Use this if desired type of map element is map. zbx_label contains label of map element. zbx_image contains name of the image used to display the element in default state. zbx_image_disabled contains name of the image used to display disabled map element. zbx_image_maintenance contains name of the image used to display map element in maintenance. zbx_image_problem contains name of the image used to display map element with problems. zbx_url contains map element URL in name:url format. More than one url could be specified by adding some prefix (e.g., zbx_url1, zbx_url2).zbx_draw_style contains link line draw style. Possible values: line, bold, dotted, dashed. zbx_trigger contains name of the trigger used as a link indicator in host_name:trigger_name format. More than one trigger could be specified by adding some prefix (e.g., zbx_trigger1, zbx_trigger2). zbx_trigger_color contains indicator color specified either as CSS3 name or as a hexadecimal code starting with #. zbx_trigger_draw_style contains indicator draw style. Possible values are the same as for zbx_draw_style.The below requirements are needed on the host that executes this module.
| Parameter | Choices/Defaults | Comments |
|---|---|---|
|
data
-
|
Graph written in DOT language.
aliases: dot_data |
|
|
default_image
-
|
Name of the Zabbix image used to display the element if this element doesn't have the
zbx_image attribute defined.aliases: image |
|
|
expand_problem
boolean
|
|
Whether the the problem trigger will be displayed for elements with a single problem.
|
|
height
-
|
Default: 600
|
Height of the map.
|
|
highlight
boolean
|
|
Whether icon highlighting is enabled.
|
|
http_login_password
string
added in 2.1 |
Basic Auth password
|
|
|
http_login_user
string
/ required
added in 2.1 |
Basic Auth login
|
|
|
label_type
-
|
|
Map element label type.
|
|
login_password
string
/ required
|
Zabbix user password.
|
|
|
login_user
string
/ required
|
Zabbix user name.
|
|
|
margin
-
|
Default: 40
|
Size of white space between map's borders and its elements.
|
|
name
-
/ required
|
Name of the map.
aliases: map_name |
|
|
server_url
string
/ required
|
URL of Zabbix server, with protocol (http or https).
url is an alias for server_url.aliases: url |
|
|
state
-
|
|
State of the map.
On
present, it will create if map does not exist or update the map if the associated data is different.On
absent will remove the map if it exists. |
|
timeout
integer
|
Default: 10
|
The timeout of API request (seconds).
|
|
validate_certs
boolean
added in 2.5 |
|
If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.
|
|
width
-
|
Default: 800
|
Width of the map.
|
###
### Example inventory:
# [web]
# web[01:03].example.com ansible_host=127.0.0.1
# [db]
# db.example.com ansible_host=127.0.0.1
# [backup]
# backup.example.com ansible_host=127.0.0.1
###
### Each inventory host presents in Zabbix with same name.
###
### Contents of 'map.j2':
# digraph G {
# graph [layout=dot splines=false overlap=scale]
# INTERNET [zbx_url="Google:https://google.com" zbx_image="Cloud_(96)"]
# {% for web_host in groups.web %}
# {% set web_loop = loop %}
# web{{ '%03d' % web_loop.index }} [zbx_host="{{ web_host }}"]
# INTERNET -> web{{ '%03d' % web_loop.index }} [zbx_trigger="{{ web_host }}:Zabbix agent on {HOST.NAME} is unreachable for 5 minutes"]
# {% for db_host in groups.db %}
# {% set db_loop = loop %}
# web{{ '%03d' % web_loop.index }} -> db{{ '%03d' % db_loop.index }}
# {% endfor %}
# {% endfor %}
# { rank=same
# {% for db_host in groups.db %}
# {% set db_loop = loop %}
# db{{ '%03d' % db_loop.index }} [zbx_host="{{ db_host }}"]
# {% for backup_host in groups.backup %}
# {% set backup_loop = loop %}
# db{{ '%03d' % db_loop.index }} -> backup{{ '%03d' % backup_loop.index }} [color="blue"]
# {% endfor %}
# {% endfor %}
# {% for backup_host in groups.backup %}
# {% set backup_loop = loop %}
# backup{{ '%03d' % backup_loop.index }} [zbx_host="{{ backup_host }}"]
# {% endfor %}
# }
# }
###
### Create Zabbix map "Demo Map" made of template 'map.j2'
- name: Create Zabbix map
zabbix_map:
server_url: http://zabbix.example.com
login_user: username
login_password: password
name: Demo map
state: present
data: "{{ lookup('template', 'map.j2') }}"
default_image: Server_(64)
expand_problem: no
highlight: no
label_type: label
delegate_to: localhost
run_once: yes
Hint
If you notice any issues in this documentation you can edit this document to improve it.