W3cubDocs

/Ansible 2.9

zabbix_mediatype – Create/Update/Delete Zabbix media types

New in version 2.9.

Synopsis

  • This module allows you to create, modify and delete Zabbix media types.

Requirements

The below requirements are needed on the host that executes this module.

  • zabbix-api >= 0.5.4

Parameters

Parameter Choices/Defaults Comments
attempt_interval
integer
Default:
10
The interval between retry attempts.
Possible range is 0-60
gsm_modem
string
Serial device name of the gsm modem.
Required when type=sms.
http_login_password
string
Basic Auth password
http_login_user
string / required
Basic Auth login
login_password
string / required
Zabbix user password.
login_user
string / required
Zabbix user name.
max_attempts
integer
Default:
3
The maximum number of attempts to send an alert.
Possible range is 0-10
max_sessions
integer
Default:
1
The maximum number of alerts that can be processed in parallel.
Possible value is 1 when type=sms and 0-100 otherwise.
message_text_limit
string
    Choices:
  • USA
  • Canada
The message text limit.
Required when type=ez_texting.
160 characters for USA and 136 characters for Canada.
name
string / required
Name of the media type.
password
string
Authentication password.
Required when type=jabber or type=ez_texting.
Required when type=email and smtp_authentication=true.
script_name
string
The name of the executed script.
Required when type=script.
script_params
list / elements=string
List of script parameters.
Required when type=script.
server_url
string / required
URL of Zabbix server, with protocol (http or https). url is an alias for server_url.

aliases: url
smtp_authentication
boolean
    Choices:
  • no
  • yes
Whether SMTP authentication with username and password should be enabled or not.
If set to true, username and password should be specified.
smtp_email
string
Email address from which notifications will be sent.
Required when type=email.
smtp_helo
string
Default:
"localhost"
SMTP HELO.
Required when type=email.
smtp_security
string
    Choices:
  • None
  • STARTTLS
  • SSL/TLS
SMTP connection security level to use.
smtp_server
string
Default:
"localhost"
SMTP server host.
Required when type=email.
smtp_server_port
integer
Default:
25
SMTP server port.
Required when type=email.
smtp_verify_host
boolean
    Choices:
  • no
  • yes
SSL verify host for SMTP.
Can be specified when smtp_security=STARTTLS or smtp_security=SSL/TLS
smtp_verify_peer
boolean
    Choices:
  • no
  • yes
SSL verify peer for SMTP.
Can be specified when smtp_security=STARTTLS or smtp_security=SSL/TLS
state
string
    Choices:
  • present
  • absent
Desired state of the mediatype.
On present, it will create a mediatype if it does not exist or update the mediatype if the associated data is different.
On absent, it will remove the mediatype if it exists.
status
string
    Choices:
  • enabled
  • disabled
Whether the media type is enabled or no.
timeout
integer
Default:
10
The timeout of API request (seconds).
type
string / required
    Choices:
  • email
  • script
  • sms
  • jabber
  • ez_texting
Type of the media type.
username
string
Username or Jabber identifier.
Required when type=jabber or type=ez_texting.
Required when type=email and smtp_authentication=true.
validate_certs
boolean
added in 2.5
    Choices:
  • no
  • yes
If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates.

Notes

Note

  • If you use login_password=zabbix, the word “zabbix” is replaced by “****” in all module output, because login_password uses no_log. See this FAQ for more information.

Examples

- name: 'Create an email mediatype with SMTP authentication'
  zabbix_mediatype:
    name: "Ops email"
    server_url: "http://example.com/zabbix/"
    login_user: Admin
    login_password: "zabbix"
    type: 'email'
    smtp_server: 'example.com'
    smtp_server_port: 2000
    smtp_email: '[email protected]'
    smtp_authentication: true
    username: 'smtp_user'
    password: 'smtp_pass'

- name: 'Create a script mediatype'
  zabbix_mediatype:
    name: "my script"
    server_url: "http://example.com/zabbix/"
    login_user: Admin
    login_password: "zabbix"
    type: 'script'
    script_name: 'my_script.py'
    script_params:
      - 'arg1'
      - 'arg2'

- name: 'Create a jabber mediatype'
  zabbix_mediatype:
    name: "My jabber"
    server_url: "http://example.com/zabbix/"
    login_user: Admin
    login_password: "zabbix"
    type: 'jabber'
    username: 'jabber_id'
    password: 'jabber_pass'

- name: 'Create an SMS mediatype'
  zabbix_mediatype:
    name: "My SMS Mediatype"
    server_url: "http://example.com/zabbix/"
    login_user: Admin
    login_password: "zabbix"
    type: 'sms'
    gsm_modem: '/dev/ttyS0'

Status

Authors

  • Ruben Tsirunyan (@rubentsirunyan)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/zabbix_mediatype_module.html