{{ ansible_managed | comment }}
# This is a configuration file for Zabbix Agent 2
# To get more information about Zabbix, visit http://www.zabbix.com

# This configuration file is "minimalized", which means all the original comments 
# are removed. The full documentation for your Zabbix Agent 2 can be found here:
# https://www.zabbix.com/documentation/{{ zabbix_agent_version }}/en/manual/appendix/config/zabbix_agent2{{ "_win" if ansible_os_family == "Windows" else "" }}

{% if ansible_os_family != "Windows" %}
PidFile={{ zabbix_agent2_pidfile }}
{% endif %}
LogType={{ zabbix_agent2_logtype }}
{% if ansible_os_family == "Windows" %}
LogFile={{ zabbix_agent2_win_logfile }}
{% else %}
LogFile={{ zabbix_agent2_logfile }}
{% endif %}
LogFileSize={{ zabbix_agent2_logfilesize }}
DebugLevel={{ zabbix_agent2_debuglevel }}
{% if zabbix_agent2_sourceip is defined and zabbix_agent2_sourceip %}
SourceIP={{ zabbix_agent2_sourceip }}
{% endif %}
Server={{ zabbix_agent2_server }}
ListenPort={{ zabbix_agent2_listenport }}
{% if zabbix_agent2_listenip is defined and zabbix_agent2_listenip !='0.0.0.0' and zabbix_agent2_listenip %}
ListenIP={{ zabbix_agent2_listenip }}
{% endif %}
{% if zabbix_agent2_statusport is defined and zabbix_agent2_statusport %}
StatusPort={{ zabbix_agent2_statusport }}
{% endif %}
ServerActive={{ zabbix_agent2_serveractive }}
{% if zabbix_agent2_hostname is defined and zabbix_agent2_hostname %}
Hostname={{ zabbix_agent2_hostname }}
{% endif %}
{% if zabbix_agent2_hostnameitem is defined and zabbix_agent2_hostnameitem %}
HostnameItem={{ zabbix_agent2_hostnameitem }}
{% endif %}
{% if zabbix_agent2_hostmetadata is defined and zabbix_agent2_hostmetadata %}
HostMetadata={{ zabbix_agent2_hostmetadata }}
{% endif %}
{% if zabbix_agent2_hostmetadataitem is defined and zabbix_agent2_hostmetadataitem %}
HostMetadataItem={{ zabbix_agent2_hostmetadataitem }}
{% endif %}
{% if zabbix_agent2_hostinterface is defined and zabbix_agent2_hostinterface %}
HostInterface={{ zabbix_agent2_hostinterface }}
{% endif %}
{% if zabbix_agent2_hostinterfaceitem is defined and zabbix_agent2_hostinterfaceitem %}
HostInterfaceItem={{ zabbix_agent2_hostinterfaceitem }}
{% endif %}
{% if zabbix_agent2_allow_key is defined and zabbix_agent2_allow_key %}
{% for item in zabbix_agent2_allow_key %}
AllowKey={{ item }}
{% endfor %}
{% endif %}
{% if zabbix_agent2_deny_key is defined and zabbix_agent2_deny_key %}
{% for item in zabbix_agent2_deny_key %}
DenyKey={{ item }}
{% endfor %}
{% endif %}
RefreshActiveChecks={{ zabbix_agent2_refreshactivechecks }}
BufferSend={{ zabbix_agent2_buffersend }}
BufferSize={{ zabbix_agent2_buffersize }}
{% if zabbix_agent2_enablepersistentbuffer is defined and zabbix_agent2_enablepersistentbuffer %}
EnablePersistentBuffer={{ zabbix_agent2_enablepersistentbuffer }}
{% endif %}
{% if zabbix_agent2_persistentbufferperiod is defined and zabbix_agent2_persistentbufferperiod %}
PersistentBufferPeriod={{ zabbix_agent2_persistentbufferperiod }}
{% endif %}
{% if zabbix_agent2_persistentbufferfile is defined and zabbix_agent2_persistentbufferfile %}
PersistentBufferFile={{ zabbix_agent2_persistentbufferfile }}
{% endif %}
{% if zabbix_agent2_zabbix_alias is defined and zabbix_agent2_zabbix_alias %}
{% if zabbix_agent2_zabbix_alias is string %}
Alias={{ zabbix_agent2_zabbix_alias }}
{% else %}
{% for item in zabbix_agent2_zabbix_alias %}
Alias={{ item }}
{% endfor %}
{% endif %}
{% endif %}
Timeout={{ zabbix_agent2_timeout }}
{% if ansible_os_family == "Windows" %}
Include={{ zabbix_agent_win_include }}
{% else %}
Include={{ zabbix_agent2_include }}/{{ zabbix_agent2_include_pattern }}
{% endif %}
{% if zabbix_agent2_additional_include is defined and zabbix_agent2_additional_include is iterable and zabbix_agent2_additional_include is not string %}
{% for include in zabbix_agent2_additional_include %}
Include={{ include }}
{% endfor %}
{% endif %}
UnsafeUserParameters={{ zabbix_agent2_unsafeuserparameters }}
{% if ansible_os_family != "Windows" %}
ControlSocket={{ zabbix_agent2_controlsocket }}
{% endif %}
{% if zabbix_agent2_tlsconnect is defined and zabbix_agent2_tlsconnect %}
TLSConnect={{ zabbix_agent2_tlsconnect }}
{% endif %}
{% if zabbix_agent2_tlsaccept is defined and zabbix_agent2_tlsaccept %}
TLSAccept={{ zabbix_agent2_tlsaccept }}
{% endif %}
{% if zabbix_agent2_tlscafile is defined and zabbix_agent2_tlscafile %}
TLSCAFile={{ zabbix_agent2_tlscafile }}
{% endif %}
{% if zabbix_agent2_tlscrlfile is defined and zabbix_agent2_tlscrlfile %}
TLSCRLFile={{ zabbix_agent2_tlscrlfile }}
{% endif %}
{% if zabbix_agent2_tlsservercertissuer is defined and zabbix_agent2_tlsservercertissuer %}
TLSServerCertIssuer={{ zabbix_agent2_tlsservercertissuer }}
{% endif %}
{% if zabbix_agent2_tlsservercertsubject is defined and zabbix_agent2_tlsservercertsubject %}
TLSServerCertSubject={{ zabbix_agent2_tlsservercertsubject }}
{% endif %}
{% if zabbix_agent2_tlscertfile is defined and zabbix_agent2_tlscertfile %}
TLSCertFile={{ zabbix_agent2_tlscertfile }}
{% endif %}
{% if zabbix_agent2_tlskeyfile is defined and zabbix_agent2_tlskeyfile %}
TLSKeyFile={{ zabbix_agent2_tlskeyfile }}
{% endif %}
{% if zabbix_agent2_tlspskidentity is defined and zabbix_agent2_tlspskidentity %}
TLSPSKIdentity={{ zabbix_agent2_tlspskidentity }}
{% endif %}
{% if zabbix_agent2_tlspskfile is defined and zabbix_agent2_tlspskfile %}
TLSPSKFile={{ zabbix_agent2_tlspskfile }}
{% endif %}
{% if zabbix_agent2_plugins is defined and zabbix_agent2_plugins is iterable %}
{% for entry in zabbix_agent2_plugins %}
{% set my_name = entry['name'] %}
{% for property in entry['options'] %}
{% set param = property['parameter'] %}
{% set value = property['value'] %}
Plugins.{{ my_name }}.{{ param }}={{ value }}
{% endfor %}
{% endfor %}
{% endif %}
{% if zabbix_agent_version is version('6.0', '>=') %}
{% if zabbix_agent2_listenbacklog is defined and zabbix_agent2_listenbacklog %}
ListenBacklog={{ zabbix_agent2_listenbacklog }}
{% endif %}
{% endif %}
