community / community.zabbix / 0.2.0 / module / zabbix_hostmacro Create/update/delete Zabbix host macros Authors: Cove (@cove), Dean Hailin Song (!UNKNOWN)community.zabbix.zabbix_hostmacro (0.2.0) — module
Install with ansible-galaxy collection install community.zabbix:==0.2.0
collections: - name: community.zabbix version: 0.2.0
manages Zabbix host macros, it can create, update or delete them.
- 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
# 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
- 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
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