community.zabbix.zabbix_script (1.8.0) — module

Create/update/delete Zabbix scripts

| "added in version" 1.7.0 of community.zabbix"

Authors: Evgeny Yurchenko (@BGmot)

Install collection

Install with ansible-galaxy collection install community.zabbix:==1.8.0


Add to requirements.yml

  collections:
    - name: community.zabbix
      version: 1.8.0

Description

This module allows you to create, update and delete scripts.


Requirements

Inputs

    
name:
    description:
    - Name of the script.
    required: true
    type: str

port:
    description:
    - Port number used for SSH and Telnet scripts.
    - Used if type is C(ssh) or C(telnet).
    required: false
    type: str

scope:
    choices:
    - action_operation
    - manual_host_action
    - manual_event_action
    default: action_operation
    description:
    - Script scope.
    - Works only with Zabbix >= 5.4. For lower versions is silently ignored which is equivalent
      of C(manual_host_action).
    required: false
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the script.
    required: false
    type: str

command:
    description:
    - Command to run.
    required: true
    type: str

timeout:
    default: 10
    description:
    - The timeout of API request (seconds).
    type: int

authtype:
    choices:
    - password
    - public_key
    description:
    - Authentication method used for SSH script type.
    - Used if type is C(ssh).
    required: false
    type: str

password:
    description:
    - Password used for SSH scripts with password authentication and Telnet scripts.
    - Used if type is C(ssh) and authtype is C(password) or type is C(telnet).
    required: false
    type: str

username:
    description:
    - User name used for authentication.
    - Used if type is C(ssh) or C(telnet)
    required: false
    type: str

menu_path:
    description:
    - Folders separated by slash that form a menu like navigation in frontend when clicked
      on host or event.
    - Used if scope is C(manual_host_action) or C(manual_event_action).
    - Works only with Zabbix >= 5.4. For lower versions is silently ignored. Prepend menu
      path to name instead.
    required: false
    type: str

publickey:
    description:
    - Name of the public key file used for SSH scripts with public key authentication.
    - Used if type is C(ssh) and authtype is C(public_key).
    required: false
    type: str

execute_on:
    choices:
    - zabbix_agent
    - zabbix_server
    - zabbix_server_proxy
    default: zabbix_server_proxy
    description:
    - Where to run the script.
    - Used if type is C(script).
    required: false
    type: str

host_group:
    default: all
    description:
    - host group name that the script can be run on. If set to 'all', the script will
      be available on all host groups.
    required: false
    type: str

login_user:
    description:
    - Zabbix user name.
    - If not set the environment variable C(ZABBIX_USERNAME) will be used.
    required: true
    type: str

parameters:
    description:
    - Array of webhook input parameters.
    - Used if type is C(webhook).
    elements: dict
    suboptions:
      name:
        description:
        - Parameter name.
        required: true
        type: str
      value:
        default: ''
        description:
        - Parameter value. Supports macros.
        required: false
        type: str
    type: list

privatekey:
    description:
    - Name of the private key file used for SSH scripts with public key authentication.
    - Used if type is C(ssh) and authtype is C(public_key).
    required: false
    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).
    - If not set the environment variable C(ZABBIX_SERVER) will be used.
    required: true
    type: str

user_group:
    default: all
    description:
    - user group name that will be allowed to run the script. If set to 'all', the script
      will be available for all user groups.
    - Used if scope is C(manual_host_action) or C(manual_event_action).
    required: false
    type: str

description:
    description:
    - Description of the script.
    required: false
    type: str

host_access:
    choices:
    - read
    - write
    default: read
    description:
    - Host permissions needed to run the script.
    - Used if scope is C(manual_host_action) or C(manual_event_action).
    required: false
    type: str

script_type:
    choices:
    - script
    - ipmi
    - ssh
    - telnet
    - webhook
    description:
    - Script type.
    - Types C(ssh), C(telnet) and C(webhook) works only with Zabbix >= 5.4.
    required: true
    type: str

confirmation:
    description:
    - Confirmation pop up text. The pop up will appear when trying to run the script from
      the Zabbix frontend.
    - Used if scope is C(manual_host_action) or C(manual_event_action).
    required: false
    type: str

login_password:
    description:
    - Zabbix user password.
    - If not set the environment variable C(ZABBIX_PASSWORD) will be used.
    required: true
    type: str

script_timeout:
    default: 30s
    description:
    - Webhook script execution timeout in seconds. Time suffixes are supported, e.g. 30s,
      1m.
    - Required if type is C(webhook).
    - 'Possible values: 1-60s.'
    required: false
    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.
    - If not set the environment variable C(ZABBIX_VALIDATE_CERTS) will be used.
    type: bool

http_login_user:
    description:
    - Basic Auth login
    type: str

http_login_password:
    description:
    - Basic Auth password
    type: str