diff --git a/roles/zabbix_agent/defaults/main.yml b/roles/zabbix_agent/defaults/main.yml index a63dde468..318351cd4 100644 --- a/roles/zabbix_agent/defaults/main.yml +++ b/roles/zabbix_agent/defaults/main.yml @@ -39,6 +39,9 @@ zabbix_agent_tlspsk_auto: false zabbix_agent_tlspskfile: /etc/zabbix/tls_psk_auto.secret zabbix_agent_unsafeuserparameters: false zabbix_agent_runas_user: zabbix +zabbix_agent_loadmodulepath: ${libdir}/modules +zabbix_agent_logremotecommands: false +zabbix_agent_startagents: 3 zabbix_agent_tlspskidentity_file: "/etc/zabbix/tls_psk_auto.identity" # Selinux related vars @@ -86,7 +89,6 @@ zabbix_agent_interfaces: dns: "{{ ansible_fqdn }}" port: "{{ zabbix_agent_listenport }}" - # statusportzabbix_agent_zabbix_alias: # Deprecate after 3.0 zabbix_agent_userparameters_templates_src: "userparameters" zabbix_agent_userparameters_scripts_src: "scripts" @@ -103,11 +105,6 @@ zabbix_agent_ipmi_privilege: 2 ####### Agent 1 Stuff Only -zabbix_agent_loadmodulepath: ${libdir}/modules -zabbix_agent_logremotecommands: 0 -zabbix_agent_maxlinespersecond: 100 -zabbix_agent_startagents: 3 - # Windows/macOS Related zabbix_version_long: 5.2.4 diff --git a/roles/zabbix_agent/templates/agent.conf.j2 b/roles/zabbix_agent/templates/agent.conf.j2 index ddce677ae..da3b8e15e 100644 --- a/roles/zabbix_agent/templates/agent.conf.j2 +++ b/roles/zabbix_agent/templates/agent.conf.j2 @@ -29,7 +29,7 @@ AllowKey={{ item }} # AllowKey= {% endif %} {% if not zabbix_agent2 and ansible_os_family != "Windows" %} -{{ (zabbix_agent_allowroot is defined and zabbix_agent_allowroot is not none) | ternary('', '# ') }}AllowRoot={{ zabbix_agent_allowroot | default('') }} +{{ (zabbix_agent_allowroot is defined and zabbix_agent_allowroot is not none) | ternary('', '# ') }}AllowRoot={{ zabbix_agent_allowroot | default (false) | ternary('1', '0') }} {% endif %} {{ (zabbix_agent_buffersend is defined and zabbix_agent_buffersend is not none) | ternary('', '# ') }}BufferSend={{ zabbix_agent_buffersend | default('') }} {{ (zabbix_agent_buffersize is defined and zabbix_agent_buffersize is not none) | ternary('', '# ') }}BufferSize={{ zabbix_agent_buffersize | default('') }} @@ -48,12 +48,14 @@ DenyKey={{ item }} {% else %} # DenyKey= {% endif %} -{{ (zabbix_agent_enablepersistentbuffer is defined and zabbix_agent_enablepersistentbuffer is not none) | ternary('', '# ') }}EnablePersistentBuffer={{ zabbix_agent_enablepersistentbuffer | default('') }} +{% if zabbix_agent2 %} +{{ (zabbix_agent_enablepersistentbuffer is defined and zabbix_agent_enablepersistentbuffer is not none) | ternary('', '# ') }}EnablePersistentBuffer={{ zabbix_agent_enablepersistentbuffer | default (false) | ternary('1', '0') }} +{% endif %} {% if not zabbix_agent2 %} -{{ (zabbix_agent_enableremotecommands is defined and zabbix_agent_enableremotecommands is not none) | ternary('', '# ') }}EnableRemoteCommands={{ zabbix_agent_enableremotecommands | default('') }} +{{ (zabbix_agent_enableremotecommands is defined and zabbix_agent_enableremotecommands is not none) | ternary('', '# ') }}EnableRemoteCommands={{ zabbix_agent_enableremotecommands | default (false) | ternary('1', '0') }} {% endif %} {% if zabbix_agent2 %} -{{ (zabbix_agent_forceactivechecksonstart is defined and zabbix_agent_forceactivechecksonstart is not none) | ternary('', '# ') }}ForceActiveChecksOnStart={{ zabbix_agent_forceactivechecksonstart | default('') }} +{{ (zabbix_agent_forceactivechecksonstart is defined and zabbix_agent_forceactivechecksonstart is not none) | ternary('', '# ') }}ForceActiveChecksOnStart={{ zabbix_agent_forceactivechecksonstart | default (false) | ternary('1', '0') }} {% endif %} {% if zabbix_agent_version is version_compare('6.2', '>=') %} {{ (zabbix_agent_heartbeatfrequency is defined and zabbix_agent_heartbeatfrequency is not none) | ternary('', '# ') }}HeartbeatFrequency={{ zabbix_agent_heartbeatfrequency | default('') }} @@ -77,7 +79,7 @@ DenyKey={{ item }} {{ (zabbix_agent_logfile is defined and zabbix_agent_logfile is not none) | ternary('', '# ') }}LogFile={{ zabbix_agent_logfile | default('') }} {{ (zabbix_agent_logfilesize is defined and zabbix_agent_logfilesize is not none) | ternary('', '# ') }}LogFileSize={{ zabbix_agent_logfilesize | default('') }} {% if not zabbix_agent2 %} -{{ (zabbix_agent_logremotecommands is defined and zabbix_agent_logremotecommands is not none) | ternary('', '# ') }}LogRemoteCommands={{ zabbix_agent_logremotecommands | default('') }} +{{ (zabbix_agent_logremotecommands is defined and zabbix_agent_logremotecommands is not none) | ternary('', '# ') }}LogRemoteCommands={{ zabbix_agent_logremotecommands | default (false) | ternary('1', '0') }} {% endif %} {{ (zabbix_agent_logtype is defined and zabbix_agent_logtype is not none) | ternary('', '# ') }}LogType={{ zabbix_agent_logtype | default('') }} {% if not zabbix_agent2 %} @@ -104,8 +106,10 @@ Plugins.{{ my_name }}.{{ param }}={{ value }} {% endfor %} {% endfor %} {% endif %} +{% if zabbix_agent2 %} {{ (zabbix_agent_pluginsocket is defined and zabbix_agent_pluginsocket is not none) | ternary('', '# ') }}PluginSocket={{ zabbix_agent_pluginsocket | default('') }} {{ (zabbix_agent_plugintimeout is defined and zabbix_agent_plugintimeout is not none) | ternary('', '# ') }}PluginTimeout={{ zabbix_agent_plugintimeout | default('') }} +{% endif %} {{ (zabbix_agent_refreshactivechecks is defined and zabbix_agent_refreshactivechecks is not none) | ternary('', '# ') }}RefreshActiveChecks={{ zabbix_agent_refreshactivechecks | default('') }} {{ (zabbix_agent_server is defined and zabbix_agent_server is not none) | ternary('', '# ') }}Server={{ zabbix_agent_server | default('') }} {{ (zabbix_agent_serveractive is defined and zabbix_agent_serveractive is not none) | ternary('', '# ') }}ServerActive={{ zabbix_agent_serveractive | default('') }} @@ -140,4 +144,4 @@ Plugins.{{ my_name }}.{{ param }}={{ value }} {{ (zabbix_agent_runas_user is defined and zabbix_agent_runas_user is not none) | ternary('', '# ') }}User={{ zabbix_agent_runas_user | default('') }} {% endif %} {{ (zabbix_agent_userparamater is defined and zabbix_agent_userparamater is not none) | ternary('', '# ') }}UserParameter={{ zabbix_agent_userparamater | default('') }} -{{ (zabbix_agent_userparamaterdir is defined and zabbix_agent_userparamaterdir is not none) | ternary('', '# ') }}UserParameterDir={{ zabbix_agent_userparamaterdir | default('') }} +{{ (zabbix_agent_userparamaterdir is defined and zabbix_agent_userparamaterdir is not none) | ternary('', '# ') }}UserParameterDir={{ zabbix_agent_userparamaterdir | default (false) | ternary('1', '0') }}