community.zabbix
community.zabbix copied to clipboard
Support for Custom Headers in httpApi
SUMMARY
Adding the ability to create custom headers to the httpapi plugin.
ISSUE TYPE
- Feature Idea
COMPONENT NAME
httpapi-plugin
ADDITIONAL INFORMATION
I would like to send a custom header with each request to the zabbix api. Such headers are required to authenticate the request to the zabbix instance.
- name: Create maintenance for host
vars:
ansible_become: false
ansible_network_os: community.zabbix.zabbix
ansible_connection: httpapi
ansible_httpapi_port: 443
ansible_httpapi_use_ssl: true
ansible_httpapi_validate_certs: true
#begin new value
ansible_httpapi_headers:
- name: AccessToken
value: SomeAccessToken
- name: SecretToken
value: SuperSecretToken
#end new value
ansible_user: "{{ zabbix_maintenance_user_name }}"
ansible_host: "{{ zabbix_host_url }}"
ansible_httpapi_pass: "{{ zabbix_maintenance_user_password }}"
community.zabbix.zabbix_maintenance:
name: "Update of {{ stack_name }} - {{ ansible_hostname }}"
host_name: "{{ ansible_hostname }}"
state: present
minutes: "{{ zabbix_maintenance_duration | default(15) }}"
# This call will fail on the first execution of a new server. So we ignore any errors
ignore_errors: true