community / community.general / 0.1.1 / module / zabbix_mediatype Create/Update/Delete Zabbix media types Authors: Ruben Tsirunyan (@rubentsirunyan) preview | supported by communitycommunity.general.zabbix_mediatype (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
This module allows you to create, modify and delete Zabbix media types.
- 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: 'ops@example.com' 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'
name: description: - Name of the media type. required: true type: str type: choices: - email - script - sms - jabber - ez_texting description: - Type of the media type. - Media types I(jabber) and I(ez_texting) workable only with Zabbix 4.2 or less. required: true type: str state: choices: - present - absent default: present description: - Desired state of the mediatype. - On C(present), it will create a mediatype if it does not exist or update the mediatype if the associated data is different. - On C(absent), it will remove the mediatype if it exists. type: str status: choices: - enabled - disabled default: enabled description: - Whether the media type is enabled or no. type: str timeout: default: 10 description: - The timeout of API request (seconds). type: int password: description: - Authentication password. - Required when I(type=jabber) or I(type=ez_texting). - Required when I(type=email) and I(smtp_authentication=true). type: str username: description: - Username or Jabber identifier. - Required when I(type=jabber) or I(type=ez_texting). - Required when I(type=email) and I(smtp_authentication=true). type: str gsm_modem: description: - Serial device name of the gsm modem. - Required when I(type=sms). type: str smtp_helo: default: localhost description: - SMTP HELO. - Required when I(type=email). type: str login_user: description: - Zabbix user name. required: true type: str server_url: aliases: - url description: - URL of Zabbix server, with protocol (http or https). C(url) is an alias for C(server_url). required: true type: str smtp_email: description: - Email address from which notifications will be sent. - Required when I(type=email). type: str script_name: description: - The name of the executed script. - Required when I(type=script). type: str smtp_server: default: localhost description: - SMTP server host. - Required when I(type=email). type: str max_attempts: default: 3 description: - The maximum number of attempts to send an alert. - Possible range is 0-10 type: int max_sessions: default: 1 description: - The maximum number of alerts that can be processed in parallel. - Possible value is 1 when I(type=sms) and 0-100 otherwise. type: int script_params: description: - List of script parameters. - Required when I(type=script). elements: str type: list smtp_security: choices: - None - STARTTLS - SSL/TLS description: - SMTP connection security level to use. type: str login_password: description: - Zabbix user password. required: true type: str validate_certs: default: true description: - If set to False, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. type: bool http_login_user: description: - Basic Auth login type: str attempt_interval: default: 10 description: - The interval between retry attempts. - Possible range is 0-60 type: int smtp_server_port: default: 25 description: - SMTP server port. - Required when I(type=email). type: int smtp_verify_host: default: false description: - SSL verify host for SMTP. - Can be specified when I(smtp_security=STARTTLS) or I(smtp_security=SSL/TLS) type: bool smtp_verify_peer: default: false description: - SSL verify peer for SMTP. - Can be specified when I(smtp_security=STARTTLS) or I(smtp_security=SSL/TLS) type: bool message_text_limit: choices: - USA - Canada description: - The message text limit. - Required when I(type=ez_texting). - 160 characters for USA and 136 characters for Canada. type: str http_login_password: description: - Basic Auth password type: str smtp_authentication: default: false description: - Whether SMTP authentication with username and password should be enabled or not. - If set to C(true), C(username) and C(password) should be specified. type: bool