community.general.zabbix_hostmacro (0.1.1) — module

Create/update/delete Zabbix host macros

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

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

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


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create new host macro or update an existing macro's value
  local_action:
    module: zabbix_hostmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    macro_name: EXAMPLE.MACRO
    macro_value: Example value
    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 host macro in Zabbix native format
  local_action:
    module: zabbix_hostmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    macro_name: "{$EXAMPLE.MACRO}"
    macro_value: Example value
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete existing host macro
  local_action:
    module: zabbix_hostmacro
    server_url: http://monitor.example.com
    login_user: username
    login_password: password
    host_name: ExampleHost
    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

host_name:
    description:
    - Name of the host.
    required: true
    type: str

login_user:
    description:
    - Zabbix user name.
    required: true
    type: str

macro_name:
    description:
    - Name of the host macro in zabbix native format C({$MACRO}) or simple format C(MACRO).
    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

macro_value:
    description:
    - Value of the host macro.
    - Required if I(state=present).
    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

http_login_password:
    description:
    - Basic Auth password
    type: str