community.zabbix.zabbix_globalmacro (1.8.0) — module

Create/update/delete Zabbix Global macros

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

Authors: Cove (@cove), Dean Hailin Song (!UNKNOWN), Timothy Test (@ttestscripting)

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

manages Zabbix Global macros, it can create, update or delete them.

For macro_type Secret the value field cannot be validated and will always be overwritten due to the secret nature of the Text.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new global macro or update an existing macro's value
  local_action:
    module: community.zabbix.zabbix_globalmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    macro_name: EXAMPLE.MACRO
    macro_value: Example value
    macro_type: 0
    macro_description: Example description
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Values with curly brackets need to be quoted otherwise they will be interpreted as a dictionary
- name: Create new global macro in Zabbix native format with Secret Type
  local_action:
    module: community.zabbix.zabbix_globalmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    macro_name: "{$EXAMPLE.MACRO}"
    macro_value: Example value
    macro_type: 1
    macro_description: Example description
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete existing global macro
  local_action:
    module: community.zabbix.zabbix_globalmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    macro_name: "{$EXAMPLE.MACRO}"
    state: absent

Inputs

    
force:
    default: 'yes'
    description:
    - Only updates an existing macro if set to C(yes).
    type: bool

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the macro.
    - On C(present), it will create if macro does not exist or update the macro if the
      associated data is different.
    - On C(absent) will remove a macro if it exists.
    required: false
    type: str

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

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

macro_name:
    description:
    - Name of the global macro in zabbix native format C({$MACRO}) or simple format C(MACRO).
    required: true
    type: str

macro_type:
    choices:
    - text
    - secret
    - vault
    default: text
    description:
    - Type of the global macro Text or Secret Text.
    - Required if I(state=present).
    - text
    - secret - Secret Text Works only with Zabbix >= 5.0 and will default to Text in lower
      versions
    - vault - Vault Secret Works only with Zabbix >= 5.2 and will default to Text in lower
      versions
    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

macro_value:
    description:
    - Value of the global macro.
    - Required if I(state=present).
    type: str

login_password:
    description:
    - Zabbix user password.
    - If not set the environment variable C(ZABBIX_PASSWORD) will be used.
    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.
    - If not set the environment variable C(ZABBIX_VALIDATE_CERTS) will be used.
    type: bool

http_login_user:
    description:
    - Basic Auth login
    type: str

macro_description:
    description:
    - Text Description of the global macro.
    - Works only with Zabbix >= 4.4 and is silently ignored in lower versions
    type: str

http_login_password:
    description:
    - Basic Auth password
    type: str