community.zabbix.zabbix_regexp (2.3.1) — module

Create/update/delete Zabbix regular expression

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

Authors: ONODERA Masaru(@masa-orca)

Install collection

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


Add to requirements.yml

  collections:
    - name: community.zabbix
      version: 2.3.1

Description

This module allows you to create, update and delete Zabbix regular expression.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# If you want to use Username and Password to be authenticated by Zabbix Server
- name: Set credentials to access Zabbix Server API
  ansible.builtin.set_fact:
    ansible_user: Admin
    ansible_httpapi_pass: zabbix
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# If you want to use API token to be authenticated by Zabbix Server
# https://www.zabbix.com/documentation/current/en/manual/web_interface/frontend_sections/administration/general#api-tokens
- name: Set API token
  ansible.builtin.set_fact:
    ansible_zabbix_auth_key: 8ec0d52432c15c91fcafe9888500cf9a607f44091ab554dbee860f6b44fac895
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Update regexp of 'File systems for discovery'
  # set task level variables as we change ansible_connection plugin here
  vars:
    ansible_network_os: community.zabbix.zabbix
    ansible_connection: httpapi
    ansible_httpapi_port: 443
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_zabbix_url_path: 'zabbixeu'  # If Zabbix WebUI runs on non-default (zabbix) path ,e.g. http://<FQDN>/zabbixeu
    ansible_host: zabbix-example-fqdn.org
  community.zabbix.zabbix_regexp:
    name: File systems for discovery
    test_string: ext2
    expressions:
      - expression: "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$"
        expression_type: result_is_true

Inputs

    
name:
    description:
    - Name of this regular expression
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the regular expression.
    type: str

expressions:
    description:
    - List of expressions.
    - The regular expression returns true when all expressions return true.
    - Required when C(state=present).
    elements: dict
    suboptions:
      case_sensitive:
        default: false
        description:
        - If true, the expression will be case sensitive.
        type: bool
      exp_delimiter:
        choices:
        - ','
        - .
        - /
        description:
        - Delimiter for expression.
        - Used if expression_type is C(any_character_string_included).
        - Default values is C(,)
        type: str
      expression:
        description:
        - A expression string
        required: true
        type: str
      expression_type:
        choices:
        - character_string_included
        - any_character_string_included
        - character_string_not_included
        - result_is_true
        - result_is_false
        description:
        - A expression string
        required: true
        type: str
    type: list

test_string:
    description:
    - A test string for this regular expression
    type: str

http_login_user:
    description:
    - Basic Auth login
    required: false
    type: str

http_login_password:
    description:
    - Basic Auth password
    required: false
    type: str

Outputs

msg:
  description: The result of the operation
  returned: success
  sample: Successfully updated regular expression setting
  type: str